Exemple #1
0
def get_fence_agent_info(argv):
    if len(argv) != 1:
        utils.err("One parameter expected")

    agent = argv[0]
    if not agent.startswith("stonith:"):
        utils.err("Invalid fence agent name")

    runner = utils.cmd_runner()

    try:
        metadata_dom = lib_ra.get_fence_agent_metadata(
            runner,
            agent.split("stonith:", 1)[1]
        )
        metadata = lib_ra.get_agent_desc(metadata_dom)
        metadata["name"] = agent
        metadata["parameters"] = lib_ra.get_fence_agent_parameters(
            runner, metadata_dom
        )

        print(json.dumps(metadata))
    except lib_ra.ResourceAgentLibError as e:
        utils.process_library_reports(
            [lib_ra.resource_agent_lib_error_to_report_item(e)]
        )
    except LibraryError as e:
        utils.process_library_reports(e.args)
Exemple #2
0
def stonith_list_options(stonith_agent):
    runner = utils.cmd_runner()
    try:
        metadata = lib_ra.get_fence_agent_metadata(runner, stonith_agent)
        desc = lib_ra.get_agent_desc(metadata)
        params = lib_ra.get_fence_agent_parameters(runner, metadata)
        resource.resource_print_options(stonith_agent, desc, params)
    except lib_ra.ResourceAgentLibError as e:
        utils.process_library_reports(
            [lib_ra.resource_agent_lib_error_to_report_item(e)]
        )
    except LibraryError as e:
        utils.process_library_reports(e.args)
Exemple #3
0
def stonith_list_options(stonith_agent):
    runner = utils.cmd_runner()
    try:
        metadata = lib_ra.get_fence_agent_metadata(runner, stonith_agent)
        desc = lib_ra.get_agent_desc(metadata)
        params = lib_ra.get_fence_agent_parameters(runner, metadata)
        # Fence agents just list the actions, usually without any attributes.
        # We could print them but it wouldn't add any usefull information.
        resource.resource_print_options(stonith_agent, desc, params, actions=[])
    except lib_ra.ResourceAgentLibError as e:
        utils.process_library_reports(
            [lib_ra.resource_agent_lib_error_to_report_item(e)]
        )
    except LibraryError as e:
        utils.process_library_reports(e.args)
Exemple #4
0
def get_fence_agent_info(argv):
    if len(argv) != 1:
        utils.err("One parameter expected")

    agent = argv[0]
    if not agent.startswith("stonith:"):
        utils.err("Invalid fence agent name")

    try:
        metadata_dom = lib_ra.get_fence_agent_metadata(
            agent.split("stonith:", 1)[1]
        )
        metadata = lib_ra.get_agent_desc(metadata_dom)
        metadata["name"] = agent
        metadata["parameters"] = lib_ra.get_fence_agent_parameters(
            metadata_dom
        )

        print(json.dumps(metadata))
    except lib_ra.LibraryError as e:
        utils.process_library_reports(e.args)