The python bindings are still very basic and cover just a few of the client features of openwsman, however, with just the limited functionality a lot can be done as can be seen in the newly checked in python code with CIM bindings.
The code can be found in subversion under the new sub-project pywsman. This is basically a simple wrapper around the bindings that full expose CIM data in a pythonic way. Code as simple as the following snippet yields useful data that can be reused in any python application:
from OWsman import * from CIM import * cl = OpenWSMan.Client("192.168.1.4", 8889, "/wsman", "http", "wsman", "secret") cs = CIM_ComputerSystem(cl) instances = cs.Enumerate() for instance in instances: instance.dump()
# python test.py Instance of http:/schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ComputerSystem { Caption: Computer System Description: A class derived from ComputerSystem that represents the single node container of the Linux OS. ElementName: miska.home.planux.com Name: miska.home.planux.com Status: NULL EnabledState: 2 OtherEnabledState: NULL RequestedState: 2 EnabledDefault: 2 CreationClassName: Linux_ComputerSystem NameFormat: IP PrimaryOwnerName: root PrimaryOwnerContact: root@miska.home.planux.com Dedicated: [ 0,] }
The CIM classes are all auto-generated and although some of the code is still experimental, it can be used in very complex scenarios.
Download the code from subversion and install openwsman with python support to try it out. More functionalty is being added every day to support additional openwman features in the bindings.
How to auto-generate the CIM classes?
> The CIM classes are all auto-generated
Are you planning on publishing the tool(s) to auto-generate them or are they available already?
Thanks,
Jan Parthey