favoretti/nsnitro — Issue #5: Deleting serviceGroups
Author: anandjeyahar
Created: 2011-12-28 12:50:20+00:00
State: open

I wrote this piece of code to delete an existing serviceGroup:

def delete_resource(self):
try:

nsb = NSBaseResource()
nsb.resourcetype = 'serviceGroup'
nsb.set_action('delete')
nsb.set_options({'name':'Test-SG-192.168.8.140'})
nsb.delete_resource(self.nitro)
print "resource deleted"
print nsb.get_name() + ":" + nsb.get_state()

except nsnitro.nsutil.NSNitroError,e:
print e.message

it throws me an error saying

"Invalid argument [name]
"

i noticed that NSBaseResource.delete_resource calls delete_get_args and appends the options. The NS 9.3 documentation doesn't mention args at all... is it there for 9.2 compatibility?? it fails on NS 9.3 with error Invalid argument..

i guess it's because serviceGroup does not classify as BaseResource and needs to be treated differently??