Ejemplo n.º 1
0
def action_get(args, nitro):
        if args.object == "csvserver":
                csvserver = NSCSVServer()
                csvserver.set_name(args.object_name)
                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])

        if args.object == "lbvserver":
                lbvserver = NSLBVServer()
                lbvserver.set_name(args.object_name)
                lbvserver = NSLBVServer.get(nitro, lbvserver)
                print "--- LB vserver: " + lbvserver.get_name() + " ---"
                for k in sorted(lbvserver.options.iterkeys(), key=lambda k: k):
                        print "\t%s: %s" % (k, lbvserver.options[k])

        if args.object == "server":
                server = NSServer()
                server.set_name(args.object_name)
                server = NSServer.get(nitro, server)
                print "--- Server: " + server.get_name() + " ---"
                for k in sorted(server.options.iterkeys(), key=lambda k: k):
                        print "\t%s: %s" % (k, server.options[k])

        if args.object == "service":
                service = NSService()
                service.set_name(args.object_name)
                service = NSService.get(nitro, service)

                print "--- Service: " + service.get_name() + " ---"
                for k in sorted(service.options.iterkeys(), key=lambda k: k):
                        print "\t%s: %s" % (k, service.options[k])
Ejemplo n.º 2
0
def _vserver_get(v_name, **connection_args):
    nitro = _connect(**connection_args)
    vserver = NSLBVServer()
    vserver.set_name(v_name)
    if nitro is None:
        return None
    try:
        vserver = NSLBVServer.get(nitro, vserver)
    except NSNitroError, e:
        log.debug('netscaler module error - NSLBVServer.get() failed: {0}'.format(e.message))
        vserver = None
Ejemplo n.º 3
0
def lbvserver_get(lbvs_name, **connection_args):
    """
    Get lb vs server
    CLI Example:
    .. code-block:: bash
        salt '*' netscaler.lbvserver_get 'lbvsName'
    """
    ret = True
    nitro = _connect(**connection_args)
    if nitro is None:
        return False
    lbvs = NSLBVServer()
    lbvs.set_name(lbvs_name)
    try:
        NSLBVServer.get(nitro, lbvs)
    except NSNitroError as error:
        log.debug("netscaler module error - NSLBVServer.get() failed: %s",
                  error)
        ret = False
    _disconnect(nitro)
    return ret
Ejemplo n.º 4
0
def _vserver_get(v_name, **connection_args):
    nitro = _connect(**connection_args)
    vserver = NSLBVServer()
    vserver.set_name(v_name)
    if nitro is None:
        return None
    try:
        vserver = NSLBVServer.get(nitro, vserver)
    except NSNitroError as error:
        log.debug("netscaler module error - NSLBVServer.get() failed: %s", error)
        vserver = None
    _disconnect(nitro)
    return vserver
Ejemplo n.º 5
0
def _vserver_get(v_name, **connection_args):
    nitro = _connect(**connection_args)
    vserver = NSLBVServer()
    vserver.set_name(v_name)
    if nitro is None:
        return None
    try:
        vserver = NSLBVServer.get(nitro, vserver)
    except NSNitroError as error:
        log.debug("netscaler module error - NSLBVServer.get() failed: {0}".format(error))
        vserver = None
    _disconnect(nitro)
    return vserver
Ejemplo n.º 6
0
def _vserver_get(v_name, **connection_args):
    nitro = _connect(**connection_args)
    vserver = NSLBVServer()
    vserver.set_name(v_name)
    if nitro is None:
        return None
    try:
        vserver = NSLBVServer.get(nitro, vserver)
    except NSNitroError, e:
        log.debug(
            'netscaler module error - NSLBVServer.get() failed: {0}'.format(
                e.message))
        vserver = None
Ejemplo n.º 7
0
                                break
                        nitro.logout()
                        sys.exit(0)

                if args.disablelbvserver:
                        lbvserver = NSLBVServer()
                        lbvserver.set_name(args.disablelbvserver)
                        NSLBVServer.disable(nitro, lbvserver)
                        print "Disabled lb vserver: %s" % args.disablelbvserver
                        nitro.logout()
                        sys.exit(0)

                if args.getlbvserver:
                        lbvserver = NSLBVServer()
                        lbvserver.set_name(args.getlbvserver)
                        lbvserver = NSLBVServer.get(nitro, lbvserver)
                        print "--- LB vserver: " + lbvserver.get_name() + " ---"
                        for k in sorted(lbvserver.options.iterkeys(), key=lambda k: k):
                                print "\t%s: %s" % (k, lbvserver.options[k])

                        nitro.logout()
                        sys.exit(0)

                if args.enablecsvserver:
                        csvserver = NSCSVServer()
                        csvserver.set_name(args.enablecsvserver)
                        NSCSVServer.enable(nitro, csvserver)
                        print "Enabled cs vserver: %s" % args.enablecsvserver
                        nitro.logout()
                        sys.exit(0)