示例#1
0
def qdevice_cmd(lib, argv, modifiers):
    if len(argv) < 1:
        usage.qdevice()
        sys.exit(1)

    sub_cmd, argv_next = argv[0], argv[1:]
    try:
        if sub_cmd == "help":
            usage.qdevice(argv)
        elif sub_cmd == "setup":
            qdevice_setup_cmd(lib, argv_next, modifiers)
        elif sub_cmd == "destroy":
            qdevice_destroy_cmd(lib, argv_next, modifiers)
        elif sub_cmd == "start":
            qdevice_start_cmd(lib, argv_next, modifiers)
        elif sub_cmd == "stop":
            qdevice_stop_cmd(lib, argv_next, modifiers)
        elif sub_cmd == "kill":
            qdevice_kill_cmd(lib, argv_next, modifiers)
        elif sub_cmd == "enable":
            qdevice_enable_cmd(lib, argv_next, modifiers)
        elif sub_cmd == "disable":
            qdevice_disable_cmd(lib, argv_next, modifiers)
        else:
            raise CmdLineInputError()
    except LibraryError as e:
        utils.process_library_reports(e.args)
    except CmdLineInputError as e:
        utils.exit_on_cmdline_input_errror(e, "qdevice", sub_cmd)
示例#2
0
def qdevice_cmd(lib, argv, modifiers):
    # pylint: disable=too-many-branches
    if not argv:
        usage.qdevice()
        sys.exit(1)

    sub_cmd, argv_next = argv[0], argv[1:]
    try:
        if sub_cmd == "help":
            usage.qdevice([" ".join(argv_next)] if argv_next else [])
        elif sub_cmd == "status":
            qdevice_status_cmd(lib, argv_next, modifiers)
        elif sub_cmd == "setup":
            qdevice_setup_cmd(lib, argv_next, modifiers)
        elif sub_cmd == "destroy":
            qdevice_destroy_cmd(lib, argv_next, modifiers)
        elif sub_cmd == "start":
            qdevice_start_cmd(lib, argv_next, modifiers)
        elif sub_cmd == "stop":
            qdevice_stop_cmd(lib, argv_next, modifiers)
        elif sub_cmd == "kill":
            qdevice_kill_cmd(lib, argv_next, modifiers)
        elif sub_cmd == "enable":
            qdevice_enable_cmd(lib, argv_next, modifiers)
        elif sub_cmd == "disable":
            qdevice_disable_cmd(lib, argv_next, modifiers)
        # following commands are internal use only, called from pcsd
        elif sub_cmd == "sign-net-cert-request":
            qdevice_sign_net_cert_request_cmd(lib, argv_next, modifiers)
        elif sub_cmd == "net-client":
            qdevice_net_client_cmd(lib, argv_next, modifiers)
        else:
            raise CmdLineInputError()
    except LibraryError as e:
        utils.process_library_reports(e.args)
    except CmdLineInputError as e:
        utils.exit_on_cmdline_input_errror(e, "qdevice", sub_cmd)
示例#3
0
def qdevice_cmd(lib, argv, modifiers):
    if len(argv) < 1:
        usage.qdevice()
        sys.exit(1)

    sub_cmd, argv_next = argv[0], argv[1:]
    try:
        if sub_cmd == "help":
            usage.qdevice(argv)
        elif sub_cmd == "status":
            qdevice_status_cmd(lib, argv_next, modifiers)
        elif sub_cmd == "setup":
            qdevice_setup_cmd(lib, argv_next, modifiers)
        elif sub_cmd == "destroy":
            qdevice_destroy_cmd(lib, argv_next, modifiers)
        elif sub_cmd == "start":
            qdevice_start_cmd(lib, argv_next, modifiers)
        elif sub_cmd == "stop":
            qdevice_stop_cmd(lib, argv_next, modifiers)
        elif sub_cmd == "kill":
            qdevice_kill_cmd(lib, argv_next, modifiers)
        elif sub_cmd == "enable":
            qdevice_enable_cmd(lib, argv_next, modifiers)
        elif sub_cmd == "disable":
            qdevice_disable_cmd(lib, argv_next, modifiers)
        # following commands are internal use only, called from pcsd
        elif sub_cmd == "sign-net-cert-request":
            qdevice_sign_net_cert_request_cmd(lib, argv_next, modifiers)
        elif sub_cmd == "net-client":
            qdevice_net_client_cmd(lib, argv_next, modifiers)
        else:
            raise CmdLineInputError()
    except LibraryError as e:
        utils.process_library_reports(e.args)
    except CmdLineInputError as e:
        utils.exit_on_cmdline_input_errror(e, "qdevice", sub_cmd)
示例#4
0
from pcs import (
    qdevice,
    usage,
)
from pcs.cli.common.routing import create_router

qdevice_cmd = create_router(
    {
        "help":
        lambda lib, argv, modifiers: usage.qdevice(argv),
        "status":
        qdevice.qdevice_status_cmd,
        "setup":
        qdevice.qdevice_setup_cmd,
        "destroy":
        qdevice.qdevice_destroy_cmd,
        "start":
        qdevice.qdevice_start_cmd,
        "stop":
        qdevice.qdevice_stop_cmd,
        "kill":
        qdevice.qdevice_kill_cmd,
        "enable":
        qdevice.qdevice_enable_cmd,
        "disable":
        qdevice.qdevice_disable_cmd,
        # following commands are internal use only, called from pcsd
        "sign-net-cert-request":
        qdevice.qdevice_sign_net_cert_request_cmd,
        "net-client":
        create_router(
示例#5
0
from pcs import (
    qdevice,
    usage,
)
from pcs.cli.common.routing import create_router

qdevice_cmd = create_router(
    {
        "help":
        lambda lib, argv, modifiers: print(usage.qdevice(argv)),
        "status":
        qdevice.qdevice_status_cmd,
        "setup":
        qdevice.qdevice_setup_cmd,
        "destroy":
        qdevice.qdevice_destroy_cmd,
        "start":
        qdevice.qdevice_start_cmd,
        "stop":
        qdevice.qdevice_stop_cmd,
        "kill":
        qdevice.qdevice_kill_cmd,
        "enable":
        qdevice.qdevice_enable_cmd,
        "disable":
        qdevice.qdevice_disable_cmd,
        # following commands are internal use only, called from pcsd
        "sign-net-cert-request":
        qdevice.qdevice_sign_net_cert_request_cmd,
        "net-client":
        create_router(