print sample id for query-samples
Provide sample id can make it possible for end user to query particular sample by its id, this is needed because we don't show everything in the list. Change-Id: I06bfc2de1a4e9a24892b2e36b6d2137e1b38cb27 Closes-Bug: #1506745
This commit is contained in:
		| @@ -682,16 +682,16 @@ class ShellQuerySamplesCommandTest(utils.BaseTestCase): | ||||
|         ceilometer_shell.do_query_samples(self.cc, self.args) | ||||
|  | ||||
|         self.assertEqual('''\ | ||||
| +--------------------------------------+----------+-------+--------+---------\ | ||||
| -+----------------------------+ | ||||
| | Resource ID                          | Meter    | Type  | Volume | Unit    \ | ||||
|  | Timestamp                  | | ||||
| +--------------------------------------+----------+-------+--------+---------\ | ||||
| -+----------------------------+ | ||||
| | bd9431c1-8d69-4ad3-803a-8d4a6b89fd36 | instance | gauge | 1      | instance\ | ||||
|  | 2014-02-19T05:50:16.673604 | | ||||
| +--------------------------------------+----------+-------+--------+---------\ | ||||
| -+----------------------------+ | ||||
| +--------------------------------------+--------------------------------------\ | ||||
| +----------+-------+--------+----------+----------------------------+ | ||||
| | ID                                   | Resource ID                          \ | ||||
| | Meter    | Type  | Volume | Unit     | Timestamp                  | | ||||
| +--------------------------------------+--------------------------------------\ | ||||
| +----------+-------+--------+----------+----------------------------+ | ||||
| | b55d1526-9929-11e3-a3f6-02163e5df1e6 | bd9431c1-8d69-4ad3-803a-8d4a6b89fd36 \ | ||||
| | instance | gauge | 1      | instance | 2014-02-19T05:50:16.673604 | | ||||
| +--------------------------------------+--------------------------------------\ | ||||
| +----------+-------+--------+----------+----------------------------+ | ||||
| ''', sys.stdout.getvalue()) | ||||
|  | ||||
|     @mock.patch('sys.stdout', new=six.StringIO()) | ||||
|   | ||||
| @@ -1171,9 +1171,9 @@ def do_query_samples(cc, args): | ||||
|     except exc.HTTPNotFound: | ||||
|         raise exc.CommandError('Samples not found') | ||||
|     else: | ||||
|         field_labels = ['Resource ID', 'Meter', 'Type', 'Volume', 'Unit', | ||||
|                         'Timestamp'] | ||||
|         fields = ['resource_id', 'meter', 'type', | ||||
|         field_labels = ['ID', 'Resource ID', 'Meter', 'Type', 'Volume', | ||||
|                         'Unit', 'Timestamp'] | ||||
|         fields = ['id', 'resource_id', 'meter', 'type', | ||||
|                   'volume', 'unit', 'timestamp'] | ||||
|         utils.print_list(samples, fields, field_labels, | ||||
|                          sortby=None) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 ZhiQiang Fan
					ZhiQiang Fan