示例#1
0
def salt_master_config(config):

    project = config.data['project']

    master_project_path = os.path.join(
        Filesystem.project_path(project),
        'master')

    master_env_path = os.path.join(
        Filesystem.current_env(),
        'master'
        )

    merged_master = Filesystem.load_file(master_project_path, master_env_path)

    return merged_master
示例#2
0
def _master_data(config):

    profiles = config.profile
    providers = _providers_for_config(config)
    config_obj = config.data.copy()
    config_obj['master'] = 'localhost'

    ssh_keys_data = _ssh_keys_for_providers(providers)
    profiles_data = Filesystem.encode(profiles)
    providers_data = Filesystem.encode(providers)

    config_data = Filesystem.encode(config_obj)

    project = config.data['project']
    master_project_path = os.path.join(
        Filesystem.project_path(project),
        'master'
    )

    master_env_path = os.path.join(
        Filesystem.current_env(),
        'master'
    )

    master = Filesystem.encode(config.master_config_data(
        files=[master_project_path, master_env_path]))

    minion = Filesystem.encode(config.minion_config_data({
        'id': 'master',
        'master': 'localhost',
        'grains': {'roles': ['master']}
        }))

    salt_data = {
    'master': master,
    'minion': minion}

    cloudseed_data = {
    'profiles': profiles_data,
    'providers': providers_data,
    'config': config_data,
    'ssh_keys': ssh_keys_data}

    return {
    'salt': salt_data,
    'cloudseed': cloudseed_data
    }