예제 #1
0
def get_config():
    if not has_state():
        raise Exception("Can't get a config without a state file")
    saved_state = load_state()
    cloud = saved_state['cloud']
    config = parse_config(CLOUD_YAML_FILE[cloud])
    return config
예제 #2
0
def _get_platform_config(cloud, region, distro):
    config = parse_config(CLOUD_YAML_FILE[cloud])

    # Get the configurations for all of the regions.
    region_configs = config['configs']['regions']

    # Get the region-specific configurations.
    region_config = region_configs.get(region)
    if not region_config:
        region_config = region_configs['default']

    # Get the different configurations for distributions in this region.
    instance_configs = region_config['distribution']

    # Get the specific configuration for this distribution in this region.
    instance_config = instance_configs.get(distro.value)
    if not instance_config:
        instance_config = instance_configs['default']

    return instance_config