def list_nodes(call=None):
    '''
    Return a list of the VMs that are on the provider
    '''
    if call == 'action':
        raise SaltCloudSystemExit(
            'The list_nodes function must be called with -f or --function.'
        )

    ret = {}
    nodes = list_nodes_full()
    if 'error' in nodes:
        raise SaltCloudSystemExit(
            'An error occurred while listing nodes: {0}'.format(
                nodes['error']['Errors']['Error']['Message']
            )
        )
    for node in nodes:
        ret[node] = {
            'id': nodes[node]['hostname'],
            'ram': nodes[node]['maxMemory'],
            'cpus': nodes[node]['maxCpu'],
        }
        if 'primaryIpAddress' in nodes[node]:
            ret[node]['public_ips'] = nodes[node]['primaryIpAddress']
        if 'primaryBackendIpAddress' in nodes[node]:
            ret[node]['private_ips'] = nodes[node]['primaryBackendIpAddress']
        if 'status' in nodes[node]:
            ret[node]['state'] = six.text_type(nodes[node]['status']['name'])
    return ret
def list_nodes ( call = None ) : if call == 'action' : raise SaltCloudSystemExit ( 'The list_nodes function must be called with -f or --function.' ) ret = { } nodes = list_nodes_full ( ) if 'error' in nodes : raise SaltCloudSystemExit ( 'An error occurred while listing nodes: {0}' . format ( nodes [ 'error' ] [ 'Errors' ] [ 'Error' ] [ 'Message' ] ) ) for node in nodes : ret [ node ] = { 'id' : nodes [ node ] [ 'hostname' ] , 'ram' : nodes [ node ] [ 'maxMemory' ] , 'cpus' : nodes [ node ] [ 'maxCpu' ] , } if 'primaryIpAddress' in nodes [ node ] : ret [ node ] [ 'public_ips' ] = nodes [ node ] [ 'primaryIpAddress' ] if 'primaryBackendIpAddress' in nodes [ node ] : ret [ node ] [ 'private_ips' ] = nodes [ node ] [ 'primaryBackendIpAddress' ] if 'status' in nodes [ node ] : ret [ node ] [ 'state' ] = six . text_type ( nodes [ node ] [ 'status' ] [ 'name' ] ) return ret
Return a list of the VMs that are on the provider