#NEWLINE# @ cliutils . arg ( '--limit' , metavar = '<limit>' , type = int , help = 'Maximum number of nodes to return per request, 0 for no limit. Default is the maximum number used by the Ironic API Service.' ) #NEWLINE# @ cliutils . arg ( '--marker' , metavar = '<node>' , help = 'Node UUID (for example, of the last node in the list from a previous request). Returns the list of nodes after this UUID.' ) #NEWLINE# @ cliutils . arg ( '--sort-key' , metavar = '<field>' , help = 'Node field that will be used for sorting.' ) #NEWLINE# @ cliutils . arg ( '--sort-dir' , metavar = '<direction>' , choices = [ 'asc' , 'desc' ] , help = 'Sort direction: "asc" (the default) or "desc".' ) #NEWLINE# @ cliutils . arg ( '--maintenance' , metavar = '<boolean>' , help = "List nodes in maintenance mode: 'true' or 'false'." ) #NEWLINE# @ cliutils . arg ( '--associated' , metavar = '<boolean>' , help = "List nodes by instance association: 'true' or 'false'." ) #NEWLINE# @ cliutils . arg ( '--provision-state' , metavar = '<provision-state>' , help = 'List nodes in specified provision state.' ) #NEWLINE# @ cliutils . arg ( '--driver' , metavar = '<driver>' , help = 'List nodes using specified driver.' ) #NEWLINE# @ cliutils . arg ( '--detail' , dest = 'detail' , action = 'store_true' , default = False , help = 'Show detailed information about the nodes.' ) #NEWLINE# @ cliutils . arg ( '--fields' , nargs = '+' , dest = 'fields' , metavar = '<field>' , action = 'append' , default = [ ] , help = "One or more node fields. Only these fields will be fetched from the server. Can not be used when '--detail' is specified." ) #NEWLINE# def do_node_list( cc , args ) : #NEWLINE# #INDENT# 'List the nodes which are registered with the Ironic service.' #NEWLINE# params = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# if ( args . associated is not None ) : #NEWLINE# #INDENT# params [ 'associated' ] = utils . bool_argument_value ( '--associated' , args . associated ) #NEWLINE# #UNINDENT# if ( args . maintenance is not None ) : #NEWLINE# #INDENT# params [ 'maintenance' ] = utils . bool_argument_value ( '--maintenance' , args . maintenance ) #NEWLINE# #UNINDENT# if ( args . provision_state is not None ) : #NEWLINE# #INDENT# params [ 'provision_state' ] = args . provision_state #NEWLINE# #UNINDENT# if ( args . driver is not None ) : #NEWLINE# #INDENT# params [ 'driver' ] = args . driver #NEWLINE# #UNINDENT# if args . detail : #NEWLINE# #INDENT# fields = res_fields . NODE_DETAILED_RESOURCE . fields #NEWLINE# field_labels = res_fields . NODE_DETAILED_RESOURCE . labels #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if args . fields : #NEWLINE# #INDENT# utils . check_for_invalid_fields ( args . fields [ 0 ] , res_fields . NODE_DETAILED_RESOURCE . fields ) #NEWLINE# resource = res_fields . Resource ( args . fields [ 0 ] ) #NEWLINE# fields = resource . fields #NEWLINE# field_labels = resource . labels #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# fields = res_fields . NODE_RESOURCE . fields #NEWLINE# field_labels = res_fields . NODE_RESOURCE . labels #NEWLINE# #UNINDENT# #UNINDENT# sort_fields = res_fields . NODE_DETAILED_RESOURCE . sort_fields #NEWLINE# sort_field_labels = res_fields . NODE_DETAILED_RESOURCE . sort_labels #NEWLINE# params . update ( utils . common_params_for_list ( args , sort_fields , sort_field_labels ) ) #NEWLINE# nodes = cc . node . list ( ** params ) #NEWLINE# cliutils . print_list ( nodes , fields , field_labels = field_labels , sortby_index = None , json_flag = args . json )