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
This commit is contained in:
Ethan Lynn
2015-12-07 23:27:13 +08:00
parent 9fe5571b7d
commit 6239b97712

View File

@@ -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='<POLICY>',