Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 3
0
                        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)
                        print "Service '%s' was binded to LB vserver '%s' with weight %d." % (args.bindservice[0], args.bindservice[1], args.bindingweight)
                        nitro.logout()
                        sys.exit(0)

                if args.enableservice: