Ejemplo n.º 1
0
def parse_arguments():
    parser = argparse.ArgumentParser(
        description="Performs initial configuration of an iDRAC.",
        formatter_class=argparse.ArgumentDefaultsHelpFormatter)

    ArgHelper.add_ip_service_tag(parser)

    parser.add_argument("-p",
                        "--pxe-nic",
                        help="""fully qualified device descriptor (FQDD) of
                                network interface to PXE boot from""",
                        metavar="FQDD")
    parser.add_argument("-c",
                        "--change-password",
                        help="The new password for the root user")
    parser.add_argument("-i",
                        "--skip-nic-config",
                        action='store_true',
                        help="Use to skip NIC configuration")

    ArgHelper.add_instack_arg(parser)
    ArgHelper.add_model_properties_arg(parser)

    LoggingHelper.add_argument(parser)

    return parser.parse_args()
Ejemplo n.º 2
0
def parse_arguments():
    parser = argparse.ArgumentParser(
        description="Loads nodes into ironic.",
        formatter_class=argparse.ArgumentDefaultsHelpFormatter)

    ArgHelper.add_instack_arg(parser)

    LoggingHelper.add_argument(parser)

    return parser.parse_args()
Ejemplo n.º 3
0
def parse_arguments():
    parser = argparse.ArgumentParser(
        description="Performs initial configuration of iDRACs.",
        formatter_class=argparse.ArgumentDefaultsHelpFormatter)

    ArgHelper.add_instack_arg(parser)
    ArgHelper.add_model_properties_arg(parser)

    LoggingHelper.add_argument(parser)

    parser.add_argument("-j",
                        "--json_config",
                        default=None,
                        help="""JSON that specifies the PXE NIC FQDD and the "
                            "new password for each overcloud node""")

    return parser.parse_args()
Ejemplo n.º 4
0
def main():
    parser = argparse.ArgumentParser(
        description="Queries an iDRAC to determine if it is ready to process "
        "commands.",
        formatter_class=argparse.ArgumentDefaultsHelpFormatter)

    ArgHelper.add_ip_service_tag(parser)
    ArgHelper.add_instack_arg(parser)
    LoggingHelper.add_argument(parser)

    args = parser.parse_args()

    LoggingHelper.configure_logging(args.logging_level)

    ip_service_tag = args.ip_service_tag
    node_definition = args.node_definition

    return_code = 0

    try:
        node = CredentialHelper.get_node_from_instack(ip_service_tag,
                                                      node_definition)
        if not node:
            raise ValueError("Unable to find {} in {}".format(
                ip_service_tag, node_definition))
        drac_ip = node["pm_addr"]
        drac_user = node["pm_user"]
        drac_password = node["pm_password"]

        drac_client = DRACClient(drac_ip, drac_user, drac_password)

        ready = drac_client.is_idrac_ready()

        if ready:
            LOG.info("iDRAC is ready")
        else:
            return_code = 1
            LOG.info("iDRAC is NOT ready")
    except:  # noqa: E501
        LOG.exception("An exception occurred:")
        return_code = 2

    sys.exit(return_code)