Пример #1
0
def status_cmd(lib, argv, modifiers):
    if len(argv) < 1:
        full_status()
        sys.exit(0)

    sub_cmd, argv_next = argv[0], argv[1:]
    try:
        if sub_cmd == "help":
            usage.status(argv_next)
        elif sub_cmd == "booth":
            booth_status_cmd(lib, argv_next, modifiers)
        elif sub_cmd == "corosync":
            corosync_status()
        elif sub_cmd == "cluster":
            cluster_status(argv_next)
        elif sub_cmd == "groups":
            resource.resource_group_list(argv_next)
        elif sub_cmd == "nodes":
            nodes_status(argv_next)
        elif sub_cmd == "pcsd":
            cluster_pcsd_status(argv_next)
        elif sub_cmd == "qdevice":
            qdevice_status_cmd(lib, argv_next, modifiers)
        elif sub_cmd == "quorum":
            quorum_status_cmd(lib, argv_next, modifiers)
        elif sub_cmd == "resources":
            resource.resource_show(argv_next)
        elif sub_cmd == "xml":
            xml_status()
        else:
            raise CmdLineInputError()
    except LibraryError as e:
        utils.process_library_reports(e.args)
    except CmdLineInputError as e:
        utils.exit_on_cmdline_input_errror(e, "status", sub_cmd)
Пример #2
0
def status_cmd(argv):
    if len(argv) == 0:
        full_status()
        sys.exit(0)

    sub_cmd = argv.pop(0)
    if (sub_cmd == "help"):
        usage.status(argv)
    elif (sub_cmd == "resources"):
        resource.resource_show(argv)
    elif (sub_cmd == "groups"):
        resource.resource_group_list(argv)
    elif (sub_cmd == "cluster"):
        cluster_status(argv)
    elif (sub_cmd == "nodes"):
        nodes_status(argv)
    elif (sub_cmd == "pcsd"):
        cluster_pcsd_status(argv)
    elif (sub_cmd == "xml"):
        xml_status()
    elif (sub_cmd == "corosync"):
        corosync_status()
    elif sub_cmd == "qdevice":
        try:
            qdevice_status_cmd(
                utils.get_library_wrapper(),
                argv,
                utils.get_modificators()
            )
        except LibraryError as e:
            utils.process_library_reports(e.args)
        except CmdLineInputError as e:
            utils.exit_on_cmdline_input_errror(e, "status", sub_cmd)
    elif sub_cmd == "quorum":
        try:
            quorum_status_cmd(
                utils.get_library_wrapper(),
                argv,
                utils.get_modificators()
            )
        except LibraryError as e:
            utils.process_library_reports(e.args)
        except CmdLineInputError as e:
            utils.exit_on_cmdline_input_errror(e, "status", sub_cmd)
    else:
        usage.status()
        sys.exit(1)