This is an automatically generated e-mail. To reply, visit: http://reviewboard-openlmi.rhcloud.com/r/461/

Ship it!

Ship It!

- Radek Novacek


On June 18th, 2013, 3:10 p.m. CEST, Peter Hatina wrote:

Review request for OpenLMI Developers.
By Peter Hatina.

Updated June 18, 2013, 3:10 p.m.

Repository: openlmi-tools

Description

Honza S.:

In a lmishell script I want to manually loop over all properties and get their values. I can use _LmiInstance.properties() to get list of properties, but there is no way, how to get property values. Either _LmiInstance.properties() should return a dictionary or there should be _LmiInstance.get_property(name) method.

Sample code:

i = c.root.cimv2.LMI_StorageExtent.first_instance()
for p in i.properties:
    print p, i.get_property(p)

-----

There is a way, how to get properties:

i = c.root.cimv2.LMI_StorageExtent.first_instance()
for p in i.properties:
    print p, getattr(i, p)
             ^^

Or how to get Names property value:
i.Names

Dunno, if it is a correct (python) way. Maybe it should be switched to a "dictionary style". I used this attitude just because of methods access.

Diffs

  • cli-tools/lmi/lmi_client_shell.py (54bd8b263002c5df9f3d7dad414e75cae9bc3c41)

View Diff