def rvalidate_plug_ins(plug_in_dir_paths, quiet=1):
    r"""
    Call the external validate_plug_ins.py program which validates the plug-in
    dir paths given to it.  Return a list containing a normalized path for
    each plug-in selected.

    Description of arguments:
    plug_in_dir_paths               A colon-separated list of plug-in
                                    directory paths.
    quiet                           If quiet is set to 1, this function will
                                    NOT write status messages to stdout.
    """

    cmd_buf = "validate_plug_ins.py \"" + plug_in_dir_paths + "\""
    if int(quiet) != 1:
        grp.rpissuing(cmd_buf)
    rc, out_buf = commands.getstatusoutput(cmd_buf)
    if rc != 0:
        message = gp.sprint_varx("rc", rc, 1) + out_buf
        grp.rprintn(out_buf, 'STDERR')
        BuiltIn().fail(
            gp.sprint_error("Validate plug ins call failed.  See" +
                            " stderr text for details.\n"))

    plug_in_packages_list = out_buf.split("\n")
    if len(plug_in_packages_list) == 1 and plug_in_packages_list[0] == "":
        return []

    return plug_in_packages_list
def rvalidate_plug_ins(plug_in_dir_paths,
                       quiet=1):

    r"""
    Call the external validate_plug_ins.py program which validates the plug-in
    dir paths given to it.  Return a list containing a normalized path for
    each plug-in selected.

    Description of arguments:
    plug_in_dir_paths               A colon-separated list of plug-in
                                    directory paths.
    quiet                           If quiet is set to 1, this function will
                                    NOT write status messages to stdout.
    """

    cmd_buf = "validate_plug_ins.py \"" + plug_in_dir_paths + "\""
    if int(quiet) != 1:
        grp.rpissuing(cmd_buf)
    rc, out_buf = commands.getstatusoutput(cmd_buf)
    if rc != 0:
        message = gp.sprint_varx("rc", rc, 1) + out_buf
        grp.rprintn(out_buf, 'STDERR')
        BuiltIn().fail(gp.sprint_error("Validate plug ins call failed.  See" +
                                       " stderr text for details.\n"))

    plug_in_packages_list = out_buf.split("\n")
    if len(plug_in_packages_list) == 1 and plug_in_packages_list[0] == "":
        return []

    return plug_in_packages_list
Пример #3
0
def bmc_power_on():
    r"""
    Power the Open BMC machine on and monitor status to verify.
    """

    grp.rprint_timen("Refreshing state data.")
    state = state_mod.get_state()
    grp.rprint_var(state)

    match_state = state_mod.anchor_state(state)

    grp.rprintn()
    cmd_buf = ["Initiate Power On", "wait=${0}"]
    grp.rpissuing_keyword(cmd_buf)
    power = BuiltIn().run_keyword(*cmd_buf)

    state_change_timeout = BuiltIn().get_variable_value(
        "${STATE_CHANGE_TIMEOUT}", default="1 min")

    # Wait for the state to change in any way.
    state_mod.wait_state(match_state,
                         wait_time=state_change_timeout,
                         interval="3 seconds",
                         invert=1)

    if state_mod.OBMC_STATES_VERSION == 0:
        cmd_buf = [
            "Create Dictionary", "power=${1}", "bmc=HOST_BOOTED",
            "boot_progress=FW Progress, Starting OS"
        ]
    else:
        # TODO: Add back boot_progress when ipmi is enabled on Witherspoon.
        cmd_buf = [
            "Create Dictionary",
            "chassis=On",
            "bmc=Ready",
            #  "boot_progress=FW Progress, Starting OS",
            "host=Running"
        ]
    grp.rdpissuing_keyword(cmd_buf)
    final_state = BuiltIn().run_keyword(*cmd_buf)

    os_host = BuiltIn().get_variable_value("${OS_HOST}", default="")

    if os_host != "":
        final_state['os_ping'] = 1
        final_state['os_login'] = 1
        final_state['os_run_cmd'] = 1

    final_state = state_mod.anchor_state(final_state)

    grp.rprintn()
    power_on_timeout = BuiltIn().get_variable_value("${POWER_ON_TIMEOUT}",
                                                    default="14 mins")
    state_mod.wait_state(final_state,
                         wait_time=power_on_timeout,
                         interval="3 seconds")
Пример #4
0
def bmc_power_on():

    r"""
    Power the Open BMC machine on and monitor status to verify.
    """

    grp.rprint_timen("Refreshing state data.")
    state = state_mod.get_state()
    grp.rprint_var(state)

    match_state = state_mod.anchor_state(state)

    grp.rprintn()
    cmd_buf = ["Initiate Power On", "wait=${0}"]
    grp.rpissuing_keyword(cmd_buf)
    power = BuiltIn().run_keyword(*cmd_buf)

    state_change_timeout = BuiltIn().get_variable_value(
        "${STATE_CHANGE_TIMEOUT}", default="1 min")

    # Wait for the state to change in any way.
    state_mod.wait_state(match_state, wait_time=state_change_timeout,
                         interval="3 seconds", invert=1)

    if state_mod.OBMC_STATES_VERSION == 0:
        cmd_buf = ["Create Dictionary", "power=${1}",
                   "bmc=HOST_BOOTED",
                   "boot_progress=FW Progress, Starting OS"]
    else:
        # TODO: Add back boot_progress when ipmi is enabled on Witherspoon.
        cmd_buf = ["Create Dictionary", "chassis=On",
                   "bmc=Ready",
                   #  "boot_progress=FW Progress, Starting OS",
                   "host=Running"]
    grp.rdpissuing_keyword(cmd_buf)
    final_state = BuiltIn().run_keyword(*cmd_buf)

    os_host = BuiltIn().get_variable_value("${OS_HOST}", default="")

    if os_host != "":
        final_state['os_ping'] = 1
        final_state['os_login'] = 1
        final_state['os_run_cmd'] = 1

    final_state = state_mod.anchor_state(final_state)

    grp.rprintn()
    power_on_timeout = BuiltIn().get_variable_value(
        "${POWER_ON_TIMEOUT}", default="14 mins")
    state_mod.wait_state(final_state, wait_time=power_on_timeout,
                         interval="3 seconds")
Пример #5
0
def bmc_power_off():
    r"""
    Power the Open BMC machine off and monitor status to verify.
    """

    grp.rprint_timen("Refreshing state data.")
    state = state_mod.get_state()
    grp.rprint_var(state)

    match_state = state_mod.anchor_state(state)

    grp.rprintn()
    cmd_buf = ["Initiate Power Off"]
    grp.rpissuing_keyword(cmd_buf)
    power = BuiltIn().run_keyword(*cmd_buf)

    state_change_timeout = BuiltIn().get_variable_value(
        "${STATE_CHANGE_TIMEOUT}", default="1 min")

    # Wait for the state to change in any way.
    state_mod.wait_state(match_state,
                         wait_time=state_change_timeout,
                         interval="3 seconds",
                         invert=1)

    if state_mod.OBMC_STATES_VERSION == 0:
        cmd_buf = [
            "Create Dictionary", "power=${0}", "bmc=HOST_POWERED_OFF",
            "boot_progress=Off"
        ]
    else:
        # TODO: Add back boot_progress when ipmi is enabled on Witherspoon.
        cmd_buf = [
            "Create Dictionary",
            "chassis=Off",
            "bmc=Ready",
            #  "boot_progress=Off",
            "host=Off"
        ]
    grp.rdpissuing_keyword(cmd_buf)
    final_state = BuiltIn().run_keyword(*cmd_buf)

    final_state = state_mod.anchor_state(final_state)

    grp.rprintn()
    power_off_timeout = BuiltIn().get_variable_value("${POWER_OFF_TIMEOUT}",
                                                     default="2 mins")
    state_mod.wait_state(final_state,
                         wait_time=power_off_timeout,
                         interval="3 seconds")
Пример #6
0
def bmc_power_off():

    r"""
    Power the Open BMC machine off and monitor status to verify.
    """

    grp.rprint_timen("Refreshing state data.")
    state = state_mod.get_state()
    grp.rprint_var(state)

    match_state = state_mod.anchor_state(state)

    grp.rprintn()
    cmd_buf = ["Initiate Power Off"]
    grp.rpissuing_keyword(cmd_buf)
    power = BuiltIn().run_keyword(*cmd_buf)

    state_change_timeout = BuiltIn().get_variable_value(
        "${STATE_CHANGE_TIMEOUT}", default="1 min")

    # Wait for the state to change in any way.
    state_mod.wait_state(match_state, wait_time=state_change_timeout,
                         interval="3 seconds", invert=1)

    if state_mod.OBMC_STATES_VERSION == 0:
        cmd_buf = ["Create Dictionary", "power=${0}",
                   "bmc=HOST_POWERED_OFF", "boot_progress=Off"]
    else:
        # TODO: Add back boot_progress when ipmi is enabled on Witherspoon.
        cmd_buf = ["Create Dictionary", "chassis=Off",
                   "bmc=Ready",
                   #  "boot_progress=Off",
                   "host=Off"]
    grp.rdpissuing_keyword(cmd_buf)
    final_state = BuiltIn().run_keyword(*cmd_buf)

    final_state = state_mod.anchor_state(final_state)

    grp.rprintn()
    power_off_timeout = BuiltIn().get_variable_value(
        "${POWER_OFF_TIMEOUT}", default="2 mins")
    state_mod.wait_state(final_state, wait_time=power_off_timeout,
                         interval="3 seconds")