Forum Discussion

Ben_Chase_15007's avatar
Ben_Chase_15007
Icon for Nimbostratus rankNimbostratus
Aug 13, 2009

Configsync status using pycontrol

Just playing around here for now, but when invoking this source:

  
 if __name__ == "__main__":  
     import pycontrol.pyControl as pc  
     import getpass  
     host = '10.1.1.1'  
     uname = 'admin'  
     upass = 'admin'  
     b = pc.BIGIP(  
         hostname = host,  
         username = uname,  
         password = upass,  
         wsdl_files = ['Management.DBVariable']  
     )  
     qval = "Configsync.State"  
     s = b.Management_DBVariable.query(qval)  
 

to get the configsync status on a machine, I get an error that makes me believe I'm passing the wrong data type. Any thoughts?

 >>>   
 Loading WSDL: Management.DBVariable.wsdl  
 Traceback (most recent call last):  
 File "C:\Py25 Files\getconfigsyncstatus.py", line 17, in   
 s = b.Management_DBVariable.query(qval)  
 File "C:\Python25\lib\site-packages\zsi-2.1_a1-py2.5.egg\ZSI\ServiceProxy.py", line 324, in __call__  
 return self.parent()._call(self.__name__, self.soapheaders)(*args, **kwargs)  
 File "C:\Python25\lib\site-packages\zsi-2.1_a1-py2.5.egg\ZSI\ServiceProxy.py", line 204, in call_closure  
 raise TypeError, 'Not supporting SOAPENC:Arrays or XSD:List'  
 TypeError: Not supporting SOAPENC:Arrays or XSD:List  
 >>> 
  • You're close! This is (most are, actually) a keyword argument, so you'll just need to add that. To help figure this type of thing out, print the special variable, _h, for any method inside of pyControl:

     
     In [3]: print b.Management_DBVariable.query._h 
     InParams Count: 1 
     variables:              Common.StringSequence 
     OutParams Count: 1 
     return:         Management.DBVariable.VariableNameValueSequence 
      
      
     In [4]: b.Management_DBVariable.query(variables = ['ConfigSync.State']) 
     Out[4]: {'return': [{'name': 'ConfigSync.State', 'value': '-1 - uninitialized or disabled config state'}]} 
     

    -Matt