コード例 #1
0
ファイル: fabfile.py プロジェクト: manti-by/Apollo
def set_defaults():
    if 'app_name' not in env.keys():
        env.app_name = 'traugott'
    if 'app_path' not in env.keys():
        env.app_path = '/home/%s/www/%s/src/app' % (env.user, env.app_name)
    if 'root_path' not in env.keys():
        env.root_path = '/home/%s/www/%s/src' % (env.user, env.app_name)
コード例 #2
0
def get_library_dir():
    """Get global library path
    Library store roles and cookbooks
    """
    key = COOKBOOKS_LIBRARY_NAME
    if key in env.keys() and os.path.exists(env[key]):
        return env[key]
    return _rel(os.path.dirname(env.real_fabfile), COOKBOOKS_LIBRARY_NAME)
コード例 #3
0
ファイル: utils.py プロジェクト: BioSoundSystems/fabmagic
def get_library_dir():
    """Get global library path
    Library store roles and cookbooks
    """
    key = COOKBOOKS_LIBRARY_NAME
    if key in env.keys() and os.path.exists(env[key]):
        return env[key]
    return _rel(os.path.dirname(env.real_fabfile), COOKBOOKS_LIBRARY_NAME)
コード例 #4
0
ファイル: cookbooks.py プロジェクト: BioSoundSystems/fabmagic
def get_info_skip_list():
    """Get recipe params skip list

    :return: list of param names
    :rtype: list
    """
    if "info_skip_list" in env.keys() and isinstance(env['info_skip_list'], (tuple, list)):
        return env['info_skip_list']
    else:
        return DEFAULT_INFO_SKIP_LIST
コード例 #5
0
ファイル: utils.py プロジェクト: BioSoundSystems/fabmagic
def get_template(name='cookbook'):
    """Get recipe template

    :param path: recipe template path
    """
    if "cookbook_template" in env.keys() and os.path.exists(env['cookbook_path']):
        return env['cookbook_template']
    elif os.path.exists(_rel(fabmagic.__path__[0], TEMPLATES_DIR_NAME, name)):
        return _rel(fabmagic.__path__[0], TEMPLATES_DIR_NAME, name)
    abort(colors.red("You need specify recipes_path"))
コード例 #6
0
ファイル: utils.py プロジェクト: petry/old_fabric-recipes
def required_envs(env_list):
    missing = []
    for var in env_list:
        if var not in env.keys():
            missing.append(var)
    if missing:
        message = "\nYou forgot to set some variables to deploy:\n"
        for var in missing:
            message += " - {0}\n".format(var)

        error(red(message))
コード例 #7
0
def get_template(name='cookbook'):
    """Get recipe template

    :param path: recipe template path
    """
    if "cookbook_template" in env.keys() and os.path.exists(
            env['cookbook_path']):
        return env['cookbook_template']
    elif os.path.exists(_rel(fabmagic.__path__[0], TEMPLATES_DIR_NAME, name)):
        return _rel(fabmagic.__path__[0], TEMPLATES_DIR_NAME, name)
    abort(colors.red("You need specify recipes_path"))
コード例 #8
0
def get_info_skip_list():
    """Get recipe params skip list

    :return: list of param names
    :rtype: list
    """
    if "info_skip_list" in env.keys() and isinstance(env['info_skip_list'],
                                                     (tuple, list)):
        return env['info_skip_list']
    else:
        return DEFAULT_INFO_SKIP_LIST
コード例 #9
0
def get_component_directory(name):
    """Get directory for given component

    Components:
    - roles
    - cookbooks

    :param name: component name
    :return: path to component directory
    """
    key = '_'.join([name, 'path'])
    if key in env.keys():
        return env[key]
    return _rel(get_library_dir(), name)
コード例 #10
0
ファイル: utils.py プロジェクト: BioSoundSystems/fabmagic
def get_component_directory(name):
    """Get directory for given component

    Components:
    - roles
    - cookbooks

    :param name: component name
    :return: path to component directory
    """
    key = '_'.join([name, 'path'])
    if key in env.keys():
        return env[key]
    return _rel(get_library_dir(), name)