diff options
author | SerenaFeng <feng.xiaowei@zte.com.cn> | 2018-03-12 21:05:51 +0800 |
---|---|---|
committer | SerenaFeng <feng.xiaowei@zte.com.cn> | 2018-03-13 10:08:32 +0800 |
commit | 12b7a2b54f4e3c36d49dec2b2620826aa7029a3e (patch) | |
tree | 000db4ce860a939214c218f9961fceb2380905c7 /testapi/testapi-client/testapiclient/cli/pods.py | |
parent | c22ede1f489a6b8df123c657a6a0001103eb7ba4 (diff) |
format output
JIRA: RELENG-348
Change-Id: I8f6edae6ed70542f5dde45d81601c35d32af96d9
Signed-off-by: SerenaFeng <feng.xiaowei@zte.com.cn>
Diffstat (limited to 'testapi/testapi-client/testapiclient/cli/pods.py')
-rw-r--r-- | testapi/testapi-client/testapiclient/cli/pods.py | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/testapi/testapi-client/testapiclient/cli/pods.py b/testapi/testapi-client/testapiclient/cli/pods.py index cdedc3e..8b2f3af 100644 --- a/testapi/testapi-client/testapiclient/cli/pods.py +++ b/testapi/testapi-client/testapiclient/cli/pods.py @@ -25,7 +25,19 @@ class PodGet(command.Lister): return parser def take_action(self, parsed_args): - self.show(client.get(self.filter_by_name(pods_url(), parsed_args))) + columns = ( + "name", + "_id", + "creator", + "role", + "mode", + "creation_date", + ) + + data = client.get( + self.filter_by_name(pods_url(), parsed_args)).get('pods', []) + + return self.format_output(columns, data) class PodGetOne(command.ShowOne): @@ -39,10 +51,10 @@ class PodGetOne(command.ShowOne): return parser def take_action(self, parsed_args): - self.show(client.get(pod_url(parsed_args))) + return self.format_output(client.get(pod_url(parsed_args))) -class PodCreate(command.Command): +class PodCreate(command.ShowOne): "Handle post request for pods" def get_parser(self, prog_name): @@ -58,8 +70,7 @@ class PodCreate(command.Command): @identity.authenticate def take_action(self, parsed_args): - self.show('Create', - client.post(pods_url(), parsed_args.pod)) + return self.format_output(client.post(pods_url(), parsed_args.pod)) class PodDelete(command.Command): @@ -74,5 +85,4 @@ class PodDelete(command.Command): @identity.authenticate def take_action(self, parsed_args): - self.show('Delete', - client.delete(pod_url(parsed_args))) + return client.delete(pod_url(parsed_args)) |