Пример #1
0
def status(address, msg):
    """write a file with custom status"""
    pxe_vars = settings.pxe_variables(cfg, address)
    logging.info('setting state to "%s"', msg)
    file_name = '%s_%s.state' % (pxe_vars['fqdn'], msg)
    file_name = os.path.join(cfg['paths']['status'], file_name)
    utils.file_write(file_name, msg)
Пример #2
0
def status(address, msg):
    """write a file with custom status"""
    pxe_vars = settings.pxe_variables(cfg, address)
    logging.info('setting state to "%s"', msg)
    file_name = '%s_%s.state' % (pxe_vars['fqdn'], msg)
    file_name = os.path.join(cfg['paths']['status'], file_name)
    utils.file_write(file_name, msg)
Пример #3
0
def rclocal(address):
    """return the rc.local file"""
    pxe_vars = settings.pxe_variables(cfg, address)
    file_name = os.path.join(cfg['paths']['templates'],
        cfg['templates']['rc_local'])
    result = utils.file_read(file_name)
    result = utils.apply_template(result, pxe_vars, file_name)
    return result
Пример #4
0
def rclocal(address):
    """return the rc.local file"""
    pxe_vars = settings.pxe_variables(cfg, address)
    file_name = os.path.join(cfg['paths']['templates'],
                             cfg['templates']['rc_local'])
    result = utils.file_read(file_name)
    result = utils.apply_template(result, pxe_vars, file_name)
    return result
Пример #5
0
def overlay(address):
    """apply templates to a file overlay and return it a gzipped tar archive"""
    pxe_vars = settings.pxe_variables(cfg, address)
    overlay = pimp.Overlay(cfg, pxe_vars['overlay'], pxe_vars['fqdn'])
    overlay.prepare(pxe_vars)
    permissions = pimp.OverlayPermissions(cfg)
    permissions.script(overlay.dst, pxe_vars['overlay'], '/target')
    result = utils.tar_gz_directory(overlay.dst)
    return result
Пример #6
0
def overlay(address):
    """apply templates to a file overlay and return it a gzipped tar archive"""
    pxe_vars = settings.pxe_variables(cfg, address)
    overlay = pimp.Overlay(cfg, pxe_vars['overlay'], pxe_vars['fqdn'])
    overlay.prepare(pxe_vars)
    permissions = pimp.OverlayPermissions(cfg)
    permissions.script(overlay.dst, pxe_vars['overlay'], '/target')
    result = utils.tar_gz_directory(overlay.dst)
    return result
Пример #7
0
def seed(address):
    """return the generated preseed file"""
    pxe_vars = settings.pxe_variables(cfg, address)
    template_cfg = settings.template(pxe_vars['fqdn'], pxe_vars['overlay'],
        pxe_vars['config'], pxe_vars)
    seed = pimp.SeedPimp(template_cfg, 'pxe')
    try:
        result = seed.pimp(pxe_vars['seeds'], pxe_vars['overlay'],
            pxe_vars['puppet_manifests'])
    except KeyError as err:
        msg = 'key %s not found in the PXE variables' % err
        logging.error(msg)
        abort(400, msg)
    else:
        return result
Пример #8
0
def seed(address):
    """return the generated preseed file"""
    pxe_vars = settings.pxe_variables(cfg, address)
    template_cfg = settings.template(pxe_vars['fqdn'], pxe_vars['overlay'],
                                     pxe_vars['config'], pxe_vars)
    seed = pimp.SeedPimp(template_cfg, 'pxe')
    try:
        result = seed.pimp(pxe_vars['seeds'], pxe_vars['overlay'],
                           pxe_vars['puppet_manifests'])
    except KeyError as err:
        msg = 'key %s not found in the PXE variables' % err
        logging.error(msg)
        abort(400, msg)
    else:
        return result
Пример #9
0
def install(address):
    """write installation started to the log"""
    pxe_vars = settings.pxe_variables(cfg, address)
    msg = '%(fqdn)s - installation started' % pxe_vars
    logging.info(msg)
    return msg
Пример #10
0
def install(address):
    """write installation started to the log"""
    pxe_vars = settings.pxe_variables(cfg, address)
    msg = '%(fqdn)s - installation started' % pxe_vars
    logging.info(msg)
    return msg