Commvault / cvpysdk

Developer SDK - Python
https://commvault.github.io/cvpysdk/
Apache License 2.0
54 stars 41 forks source link

Fetching commvault clients #49

Closed shruthijanakiram closed 6 years ago

shruthijanakiram commented 6 years ago

I have fetched client list in comserve using a python script. But I am getting the output in object format, due to which I am unable to iterate client one by one.

Script:

from cvpysdk.commcell import Commcell commcell = Commcell('comserve', 'username','password') clt = commcell.clients print clt

for i in clt: print "the Client is:",i

Error:

TypeError: 'Clients' object is not iterable

GoelJatin commented 6 years ago

Hi @shruthijanakiram ,

Can you please confirm the version of SDK you're using?

commcell.clients returns an instance of the Clients class

We added support for iterating over this object from SP12 branch.

You can either update to the latest version of the SDK or if you wish to use the SDK currently installed on your client, then you need to use the all_clients property from the clients object.

for client in commcell.clients.all_clients: print client

shruthijanakiram commented 6 years ago

Great thanks for the quick response .

The above command is working fine. I have recently installed SP12.

Can I know the command to check the SP version?

GoelJatin commented 6 years ago

You can either check using pip, or directly from the Python interpreter.

  1. pip freeze | find "cvpysdk"

  2. python >>> import cvpysdk >>> print(cvpysdk.__version__)

GoelJatin commented 6 years ago

Closing the issue.