#NEWLINE# def list_nodes( call = None ) : #NEWLINE# #INDENT# ' Return a list of the BareMetal servers that are on the provider.\n    ' #NEWLINE# if ( call == 'action' ) : #NEWLINE# #INDENT# raise SaltCloudSystemExit ( 'The list_nodes function must be called with -f or --function.' ) #NEWLINE# #UNINDENT# items = query ( method = 'servers' ) #NEWLINE# ret = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# for node in items [ 'servers' ] : #NEWLINE# #INDENT# public_ips = [ ] #NEWLINE# private_ips = [ ] #NEWLINE# image_id = '' #NEWLINE# if node . get ( 'public_ip' ) : #NEWLINE# #INDENT# public_ips = [ node [ 'public_ip' ] [ 'address' ] ] #NEWLINE# #UNINDENT# if node . get ( 'private_ip' ) : #NEWLINE# #INDENT# private_ips = [ node [ 'private_ip' ] ] #NEWLINE# #UNINDENT# if node . get ( 'image' ) : #NEWLINE# #INDENT# image_id = node [ 'image' ] [ 'id' ] #NEWLINE# #UNINDENT# ret [ node [ 'name' ] ] = { #NEWLINE# #INDENT# 'id' : node [ 'id' ] , #NEWLINE# 'image_id' : image_id , #NEWLINE# 'public_ips' : public_ips , #NEWLINE# 'private_ips' : private_ips , #NEWLINE# 'size' : node [ 'volumes' ] [ '0' ] [ 'size' ] , #NEWLINE# 'state' : node [ 'state' ] , #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# return ret