def servicegroup_add(sg_name, sg_type='HTTP', **connection_args): ''' Add a new service group If no service type is specified, HTTP will be used. Most common service types: HTTP, SSL, and SSL_BRIDGE CLI Example: .. code-block:: bash salt '*' netscaler.servicegroup_add 'serviceGroupName' salt '*' netscaler.servicegroup_add 'serviceGroupName' 'serviceGroupType' ''' ret = True if servicegroup_exists(sg_name): return False nitro = _connect(**connection_args) if nitro is None: return False sg = NSServiceGroup() sg.set_servicegroupname(sg_name) sg.set_servicetype(sg_type.upper()) try: NSServiceGroup.add(nitro, sg) except NSNitroError as e: log.debug( 'netscaler module error - NSServiceGroup.add() failed: {0}'.format( e.message)) ret = False _disconnect(nitro) return ret
def servicegroup_add(sg_name, sg_type='HTTP', **connection_args): ''' Add a new service group If no service type is specified, HTTP will be used. Most common service types: HTTP, SSL, and SSL_BRIDGE CLI Example: .. code-block:: bash salt '*' netscaler.servicegroup_add 'serviceGroupName' salt '*' netscaler.servicegroup_add 'serviceGroupName' 'serviceGroupType' ''' ret = True if servicegroup_exists(sg_name): return False nitro = _connect(**connection_args) if nitro is None: return False sg = NSServiceGroup() sg.set_servicegroupname(sg_name) sg.set_servicetype(sg_type.upper()) try: NSServiceGroup.add(nitro, sg) except NSNitroError, e: log.debug('netscaler module error - NSServiceGroup.add() failed: {0}'.format(e.message)) ret = False
def action_addservicegroup(args, nitro): servicegroup = NSServiceGroup() servicegroup.set_servicegroupname = (args.servicegroupname) servicegroup.set_state = (args.sgstate) NSServiceGroup.add(nitro, servicegroup) print "ServiceGroup might of been added if your lucky"