From e29c8097e10dec7bfa54549c09f9a5f8ad0668c0 Mon Sep 17 00:00:00 2001 From: tengqm Date: Sun, 15 Feb 2015 20:53:08 +0800 Subject: [PATCH] Added policy schema show support --- senlinclient/v1/shell.py | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/senlinclient/v1/shell.py b/senlinclient/v1/shell.py index 3037a591..b6798293 100644 --- a/senlinclient/v1/shell.py +++ b/senlinclient/v1/shell.py @@ -232,6 +232,28 @@ def do_policy_type_show(sc, args): print(jsonutils.dumps(policy_type, indent=2)) +@utils.arg('policy_type', metavar='', + help=_('Policy type to generate a template for.')) +@utils.arg('-F', '--format', metavar='', + help=_("The template output format, one of: %s.") + % ', '.join(utils.supported_formats.keys())) +def do_policy_type_schema(sc, args): + '''Get the spec of a policy type.''' + try: + params = {'policy_type': args.policy_type} + schema = sc.get(models.PolicyTypeSchema, params) + except exc.HTTPNotFound: + raise exc.CommandError( + _('Policy type %s not found.') % args.policy_type) + + schema = dict(schema) + + if args.format: + print(utils.format_output(schema, format=args.format)) + else: + print(utils.format_output(schema)) + + @utils.arg('policy_type', metavar='', help=_('Policy type to generate a template for.')) @utils.arg('-F', '--format', metavar='', @@ -528,7 +550,6 @@ def do_cluster_node_list(sc, args): def _short_physical_id(obj): return obj.physical_id[:8] + ' ...' - query = { 'cluster_id': args.id, 'show_deleted': args.show_deleted,