Forum Discussion

lizhuh_55036's avatar
lizhuh_55036
Icon for Nimbostratus rankNimbostratus
May 29, 2009

How to use pyControl to retrieve Failover.UnitId?

I am trying to use pyControl to retrieve Failover.UnitId,

 

 

db = pyControl.BIGIP(

 

hostname = host,

 

username = username,

 

password = password,

 

wsdl_files = ['Management.DBVariable']

 

)

 

 

unitid = db.Management_DBVariable.query(['Failover.UnitId'])['return']

 

 

But it crashed with following error msg

 

 

File "C:\view\LB\vcc\sw\java-modules\da\lb\bigip\src\inventory.py", line 64, in get_failover

 

unitid = db.Management_DBVariable.query(['Failover.UnitId'])['return']

 

File "C:\Python25\lib\site-packages\zsi-2.1_a1-py2.5.egg\ZSI\ServiceProxy.py", line 324, in __call__

 

File "C:\Python25\lib\site-packages\zsi-2.1_a1-py2.5.egg\ZSI\ServiceProxy.py", line 204, in call_closure

 

TypeError: Not supporting SOAPENC:Arrays or XSD:List

 

 

According to the published soap API,

 

VariableNameValue [] query(

 

in String [] variables

 

);

 

 

My syntax was correct. Could someone share what I did wrong here?

 

 

Linda
  • Hi Linda: looking at the iControl SDK it looks like you need to pass a keyword argument to this method. Here's the correct syntax:

     
     In [4]:  b.Management_DBVariable.query(variables = ['Failover.UnitID']) 
     Out[4]: {'return': [{'name': 'Failover.UnitID', 'value': '1'}]} 
     

    Also, when in question, you can print a hidden variable for any method, '_h', which will give you a hint as to parameters:

     
     In [6]: print b.Management_DBVariable.query._h 
     InParams Count: 1 
     variables:              Common.StringSequence 
     OutParams Count: 1 
     return:         Management.DBVariable.VariableNameValueSequence 
     

    I hope this helps,

    -Matt