#NEWLINE# def take_action( self , parsed_args ) : #NEWLINE# #INDENT# compute_client = self . app . client_manager . compute #NEWLINE# identity_client = self . app . client_manager . identity #NEWLINE# project_id = None #NEWLINE# if parsed_args . project : #NEWLINE# #INDENT# project_id = identity_common . find_project ( identity_client , parsed_args . project , parsed_args . project_domain ) . id #NEWLINE# parsed_args . all_projects = True #NEWLINE# #UNINDENT# user_id = None #NEWLINE# if parsed_args . user : #NEWLINE# #INDENT# user_id = identity_common . find_user ( identity_client , parsed_args . user , parsed_args . user_domain ) . id #NEWLINE# #UNINDENT# flavor_id = None #NEWLINE# if parsed_args . flavor : #NEWLINE# #INDENT# flavor_id = utils . find_resource ( compute_client . flavors , parsed_args . flavor ) . id #NEWLINE# #UNINDENT# image_id = None #NEWLINE# if parsed_args . image : #NEWLINE# #INDENT# image_id = utils . find_resource ( compute_client . images , parsed_args . image ) . id #NEWLINE# #UNINDENT# search_opts = { #NEWLINE# #INDENT# 'reservation_id' : parsed_args . reservation_id , #NEWLINE# 'ip' : parsed_args . ip , #NEWLINE# 'ip6' : parsed_args . ip6 , #NEWLINE# 'name' : parsed_args . name , #NEWLINE# 'instance_name' : parsed_args . instance_name , #NEWLINE# 'status' : parsed_args . status , #NEWLINE# 'flavor' : flavor_id , #NEWLINE# 'image' : image_id , #NEWLINE# 'host' : parsed_args . host , #NEWLINE# 'tenant_id' : project_id , #NEWLINE# 'all_tenants' : parsed_args . all_projects , #NEWLINE# 'user_id' : user_id , #NEWLINE# #UNINDENT# } #NEWLINE# self . log . debug ( 'search options: %s' , search_opts ) #NEWLINE# if parsed_args . long : #NEWLINE# #INDENT# columns = ( 'ID' , 'Name' , 'Status' , 'OS-EXT-STS:task_state' , 'OS-EXT-STS:power_state' , 'Networks' , 'OS-EXT-AZ:availability_zone' , 'OS-EXT-SRV-ATTR:host' , 'Metadata' ) #NEWLINE# column_headers = ( 'ID' , 'Name' , 'Status' , 'Task State' , 'Power State' , 'Networks' , 'Availability Zone' , 'Host' , 'Properties' ) #NEWLINE# mixed_case_fields = [ 'OS-EXT-STS:task_state' , 'OS-EXT-STS:power_state' , 'OS-EXT-AZ:availability_zone' , 'OS-EXT-SRV-ATTR:host' ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# columns = ( 'ID' , 'Name' , 'Status' , 'Networks' ) #NEWLINE# column_headers = ( 'ID' , 'Name' , 'Status' , 'Networks' ) #NEWLINE# mixed_case_fields = [ ] #NEWLINE# #UNINDENT# marker_id = None #NEWLINE# if parsed_args . marker : #NEWLINE# #INDENT# marker_id = utils . find_resource ( compute_client . servers , parsed_args . marker ) . id #NEWLINE# #UNINDENT# data = compute_client . servers . list ( search_opts = search_opts , marker = marker_id , limit = parsed_args . limit ) #NEWLINE# return ( column_headers , ( utils . get_item_properties ( s , columns , mixed_case_fields = mixed_case_fields , formatters = { #NEWLINE# #INDENT# 'OS-EXT-STS:power_state' : _format_servers_list_power_state , #NEWLINE# 'Networks' : _format_servers_list_networks , #NEWLINE# 'Metadata' : utils . format_dict , #NEWLINE# #UNINDENT# } ) for s in data ) )