favoretti/nsnitro — Issue #8: bug in lbvserver servicebinding
Author: anandjeyahar
Created: 2012-01-03 12:17:43+00:00
State: open

I am passing weight value in the following code and still says weight value is missing... Might be a nitro error itself..

from nsnitro.nsresources.nslbvserverservicebinding import NSLBVServerServiceBinding
from nsnitro.nsnitro import NSNitro

random_vip = '192.168.8.153'
sg = { 'servicegroupname':"Test-SG-%s"%random_vip,
'name':"Test-lbvserver-%s"%random_vip,
'weight':20
}

nitro_session_obj = NSNitro("10.11.254.30","ddosadmin","ddosAdmin")
nitro_session_obj.login()

lbbinding = NSLBVServerServiceBinding(sg)
print NSLBVServerServiceBinding.add(nitro_session_obj,lbbinding)

gives error:

Traceback (most recent call last):
File "../ex.py", line 18, in
print NSLBVServerServiceBinding.add(nitro_session_obj,lbbinding)
File "/usr/local/lib/python2.7/dist-packages/nsnitro-1.0.6-py2.7.egg/nsnitro/nsresources/nslbvserverservicebinding.py", line 179, in add
return __vserver_service_binding.update_resource(nitro)
File "/usr/local/lib/python2.7/dist-packages/nsnitro-1.0.6-py2.7.egg/nsresources/nsbaseresource.py", line 80, in update_resource
response = nitro.put(self.get_put_payload(nitro.get_sessionid()))
File "/usr/local/lib/python2.7/dist-packages/nsnitro-1.0.6-py2.7.egg/nsnitro/nsnitro.py", line 92, in put
raise NSNitroError(nsresponse.message)
nsnitro.nsutil.NSNitroError: u'Argument pre-requisite missing [weight, serviceName]'

Also if i pass both servicegroup and service both, it would be nice to have the python class raise an error before connecting and trying on the NetScaler...