def get_qs_regions()

in build/update_instance_types.py [0:0]


def get_qs_regions(ec2, auth_map):
    if not TASKCAT_PROJECT_CONFIG.exists():
        return {r['RegionName']: auth_map.get(r['RegionName'], auth_map['default']) for r in ec2.describe_regions()['Regions'] if r['OptInStatus'] != 'not-opted-in'}
    with open(TASKCAT_PROJECT_CONFIG, 'r') as fh:
        config = yaml.safe_load(fh)
        regions = set(config.get('project', {}).get('regions', []))
        for t in config.get('tests', {}).values():
            regions.update(set(t.get('regions', {})))
        return {r: auth_map.get(r, auth_map['default']) for r in regions}