From 6239b97712fabc28ef1f0c5a517357c0819f4257 Mon Sep 17 00:00:00 2001 From: Ethan Lynn Date: Mon, 7 Dec 2015 23:27:13 +0800 Subject: [PATCH] Try to show policy after policy created Try to show policy after policy created, like what we do after profile created, so that we can display created_time. Closes-Bug: #1522324 Change-Id: I85eb5c7335315fb2f0a10b79ceaa4f228e4d7d2d --- senlinclient/v1/shell.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/senlinclient/v1/shell.py b/senlinclient/v1/shell.py index 3d1885e5..1ae614e2 100644 --- a/senlinclient/v1/shell.py +++ b/senlinclient/v1/shell.py @@ -383,12 +383,11 @@ def do_policy_list(sc, args=None): utils.print_list(policies, fields, formatters=formatters, sortby_index=1) -def _show_policy(sc, policy_id=None, policy=None): - if policy is None: - try: - policy = sc.get_policy(policy_id) - except exc.HTTPNotFound: - raise exc.CommandError(_('Policy not found: %s') % policy_id) +def _show_policy(sc, policy_id): + try: + policy = sc.get_policy(policy_id) + except exc.HTTPNotFound: + raise exc.CommandError(_('Policy not found: %s') % policy_id) formatters = { 'metadata': utils.json_formatter, @@ -418,7 +417,7 @@ def do_policy_create(sc, args): } policy = sc.create_policy(**attrs) - _show_policy(sc, policy=policy) + _show_policy(sc, policy.id) @utils.arg('id', metavar='',