コード例 #1
0
ファイル: webservice.py プロジェクト: nwhalen/romgrid
def renderPreseedFile(seed_type):
    """
    Renders the requested type of seed file.

    :param seed_type:
    :return:
    """
    preseed_template = templates.fetch('preseed', '%s-preseed' %seed_type)
    name,username,password = templates.fetch('preseed', '.base_user').split(':')

    preseed_template += "\nd-i passwd/user-fullname string %s\n" \
        "d-i passwd/username string %s\n" \
        "d-i passwd/user-password-crypted password %s\n" %(name,username,password)

    return Response(preseed_template, mimetype='text/plain')
コード例 #2
0
ファイル: webservice.py プロジェクト: nwhalen/romgrid
def createMinionConfig():
    """
    Registers the minion with the Salt server and creates the config file for it (which is returned as the body).

    :return: String containing the minion config file.
    """
    minion_uuid = request.args.get('uuid')

    if not id:
        abort(400, 'Missing UUID')
    if not minion_uuid:
        abort(400, 'Missing MAC')

    # Add the ID to the minion config and send it back
    minion_cfg = templates.fetch('salt', 'minion')
    minion_cfg += "\nid: %s\n" %minion_uuid

    return Response(minion_cfg, mimetype='text/plain')