예제 #1
0
def avail_locations(conn=None, call=None):
    """
    Return a list of locations
    """
    if call == "action":
        raise SaltCloudSystemExit(
            "The avail_locations function must be called with " "-f or --function, or with the --list-locations option"
        )

    if conn is None:
        conn = get_conn()

    endpoints = nova.get_entry(conn.get_catalog(), "type", "compute")["endpoints"]
    ret = {}
    for endpoint in endpoints:
        ret[endpoint["region"]] = endpoint

    return ret
예제 #2
0
파일: nova.py 프로젝트: zhangxc73912/salt
def avail_locations(conn=None, call=None):
    '''
    Return a list of locations
    '''
    if call == 'action':
        raise SaltCloudSystemExit(
            'The avail_locations function must be called with '
            '-f or --function, or with the --list-locations option')

    if conn is None:
        conn = get_conn()

    endpoints = nova.get_entry(conn.get_catalog(), 'type',
                               'compute')['endpoints']
    ret = {}
    for endpoint in endpoints:
        ret[endpoint['region']] = endpoint

    return ret
예제 #3
0
def avail_locations(conn=None, call=None):
    '''
    Return a list of locations
    '''
    if call == 'action':
        raise SaltCloudSystemExit(
            'The avail_locations function must be called with '
            '-f or --function, or with the --list-locations option'
        )

    if conn is None:
        conn = get_conn()

    endpoints = nova.get_entry(conn.get_catalog(), 'type', 'compute')['endpoints']
    ret = {}
    for endpoint in endpoints:
        ret[endpoint['region']] = endpoint

    return ret