示例#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