Exemplo n.º 1
0
    def assert_wait_fail(self, command, cib_resources_xml):
        wait_error_message = outdent(
            """\
            Pending actions:
                    Action 39: stonith-vm-rhel72-1-reboot  on vm-rhel72-1
            Error performing operation: Timer expired
            """
        )

        runner.set_runs(fixture_pre_timeout_calls(cib_resources_xml) + [
            Call(
                "crm_resource --wait --timeout=10",
                stderr=wait_error_message,
                returncode=62,
            ),
        ])

        assert_raise_library_error(
            command,
            (
                severities.ERROR,
                report_codes.WAIT_FOR_IDLE_TIMED_OUT,
                {
                    "reason": wait_error_message.strip(),
                },
                None
            )
        )
        runner.assert_everything_launched()
Exemplo n.º 2
0
def fixture_agent_load_calls():
    return [
        Call(
            "crm_resource --show-metadata ocf:heartbeat:Dummy",
            open(rc("resource_agent_ocf_heartbeat_dummy.xml")).read()
        ),
    ]
Exemplo n.º 3
0
def call_wait(timeout, retval=0, stderr=""):
    return [
        Call(
            "crm_resource --wait --timeout={0}".format(timeout),
            stderr=stderr,
            returncode=retval
        ),
    ]
Exemplo n.º 4
0
def fixture_pre_timeout_calls(cib_resources_xml):
    return (
        fixture_agent_load_calls()
        +
        [
            Call("crm_resource -?", "--wait"),
        ]
        +
        fixture_cib_calls(cib_resources_xml)
    )
def fixture_cib_calls(cib_resources_xml):
    cib_xml = open(rc("cib-empty.xml")).read()

    cib = etree.fromstring(cib_xml)
    resources_section = cib.find(".//resources")
    for child in etree.fromstring(cib_resources_xml):
        resources_section.append(child)

    return [
        Call("cibadmin --local --query", cib_xml),
        Call(
            "cibadmin --replace --verbose --xml-pipe --scope configuration",
            check_stdin=Call.create_check_stdin_xml(etree.tostring(cib))
        ),
    ]
Exemplo n.º 6
0
def call_wait_supported():
    return [
        Call("crm_resource -?", "--wait"),
    ]
Exemplo n.º 7
0
def call_status(status):
    return [
        Call("/usr/sbin/crm_mon --one-shot --as-xml --inactive", status),
    ]
Exemplo n.º 8
0
def call_cib_upgrade():
    return [
        Call("cibadmin --upgrade --force"),
    ]
Exemplo n.º 9
0
def call_cib_push(cib):
    return [
        Call("cibadmin --replace --verbose --xml-pipe --scope configuration",
             check_stdin=Call.create_check_stdin_xml(cib)),
    ]
Exemplo n.º 10
0
def call_cib_load(cib):
    return [
        Call("cibadmin --local --query", cib),
    ]