Exemple #1
0
def action_addservice(args, nitro):
        service = NSService()
        service.set_port(args.port)
        service.set_servicetype(args.servicetype)
        service.set_clttimeout(args.clttimeout)
        service.set_svrtimeout(args.svrtimeout)
        service.set_name(args.service)
        service.set_servername(args.target)
        NSService.add(nitro, service)
        print "Service '%s:%d/%s' was added to '%s'." % (args.service, args.port, args.servicetype, args.target)
Exemple #2
0
def action_addservice(args, nitro):
        service = NSService()
        service.set_port(args.port)
        service.set_servicetype(args.servicetype)
        service.set_clttimeout(args.clttimeout)
        service.set_svrtimeout(args.svrtimeout)
        service.set_name(args.service)
        service.set_servername(args.target)
        NSService.add(nitro, service)
        print "Service '%s:%d/%s' was added to '%s'." % (args.service, args.port, args.servicetype, args.target)
Exemple #3
0
                        csvserver = NSCSVServer.get(nitro, csvserver)
                        print "--- CS vserver: " + csvserver.get_name() + " ---"
                        for k in sorted(csvserver.options.iterkeys(), key=lambda k: k):
                                print "\t%s: %s" % (k, csvserver.options[k])

                        nitro.logout()
                        sys.exit(0)

                if args.addservice:
                        if not args.port:
                          print "--port is required for adding service"
                          nitro.logout()
                          sys.exit(0)
                        service = NSService()
                        service.set_port(args.port)
                        service.set_servicetype(args.servicetype)
                        service.set_clttimeout(args.clttimeout)
                        service.set_svrtimeout(args.svrtimeout)
                        service.set_name(args.addservice[0])
                        service.set_servername(args.addservice[1])
                        NSService.add(nitro, addservice)
                        print "Service '%s:%d/%s' was added to '%s'." % (args.addservice[0], args.port, args.servicetype, args.addservice[1])
                        nitro.logout()
                        sys.exit(0)

                if args.bindservice:
                        binding = NSLBVServerServiceBinding()
                        binding.set_weight(args.bindingweight)
                        binding.set_servicename(args.bindservice[0])
                        binding.set_name(args.bindservice[1])
                        NSLBVServerServiceBinding.add(nitro, binding)