예제 #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()
예제 #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()
        ),
    ]
예제 #3
0
def call_wait(timeout, retval=0, stderr=""):
    return [
        Call(
            "crm_resource --wait --timeout={0}".format(timeout),
            stderr=stderr,
            returncode=retval
        ),
    ]
예제 #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))
        ),
    ]
예제 #6
0
파일: fixture.py 프로젝트: cwjenkins/pcs
def call_wait_supported():
    return [
        Call("crm_resource -?", "--wait"),
    ]
예제 #7
0
파일: fixture.py 프로젝트: cwjenkins/pcs
def call_status(status):
    return [
        Call("/usr/sbin/crm_mon --one-shot --as-xml --inactive", status),
    ]
예제 #8
0
파일: fixture.py 프로젝트: cwjenkins/pcs
def call_cib_upgrade():
    return [
        Call("cibadmin --upgrade --force"),
    ]
예제 #9
0
파일: fixture.py 프로젝트: cwjenkins/pcs
def call_cib_push(cib):
    return [
        Call("cibadmin --replace --verbose --xml-pipe --scope configuration",
             check_stdin=Call.create_check_stdin_xml(cib)),
    ]
예제 #10
0
파일: fixture.py 프로젝트: cwjenkins/pcs
def call_cib_load(cib):
    return [
        Call("cibadmin --local --query", cib),
    ]