Пример #1
0
def generate_user_data_for_status(node, status=None, extra_content=None):
    """Produce a user_data script based on the node's status."""
    templates = {
        NODE_STATUS.COMMISSIONING: 'commissioning.template',
        NODE_STATUS.TESTING: 'testing.template',
        NODE_STATUS.DISK_ERASING: 'disk_erasing.template',
        NODE_STATUS.RESCUE_MODE: 'rescue_mode.template',
    }
    if status is None:
        status = node.status
    userdata_template_file = os.path.join(
        get_userdata_template_dir(), templates[status])
    return generate_user_data(node, userdata_template_file, extra_content)
Пример #2
0
def generate_user_data_for_status(
        node, status=None, extra_content=None,
        rack_controller=None, request=None):
    """Produce a user_data script based on the node's status."""
    templates = {
        NODE_STATUS.NEW: 'enlistment.template',
        NODE_STATUS.COMMISSIONING: 'commissioning.template',
        NODE_STATUS.TESTING: 'script_runner.template',
        NODE_STATUS.DISK_ERASING: 'disk_erasing.template',
        NODE_STATUS.RESCUE_MODE: 'script_runner.template',
    }
    if status is None:
        status = node.status
    userdata_template_file = os.path.join(
        get_userdata_template_dir(), templates[status])
    return generate_user_data(
        node, userdata_template_file, extra_content, rack_controller, request)
Пример #3
0
def generate_user_data_for_status(node,
                                  status=None,
                                  extra_content=None,
                                  rack_controller=None,
                                  request=None):
    """Produce a user_data script based on the node's status."""
    if status is None:
        status = node.status

    if status == NODE_STATUS.DISK_ERASING:
        template = "disk_erasing.template"
    else:
        template = "script_runner.template"

    userdata_template_file = os.path.join(get_userdata_template_dir(),
                                          template)
    return generate_user_data(node, userdata_template_file, extra_content,
                              rack_controller, request)
Пример #4
0
def generate_user_data_for_poweroff(node, request=None):
    """Produce the poweroff user_data script."""
    userdata_template_file = os.path.join(get_userdata_template_dir(),
                                          "poweroff.template")
    return generate_user_data(node, userdata_template_file, request=request)
Пример #5
0
def generate_user_data_for_poweroff(node):
    """Produce the poweroff user_data script."""
    userdata_template_file = os.path.join(
        get_userdata_template_dir(), 'poweroff.template')
    return generate_user_data(node, userdata_template_file)