You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ariatosca.apache.org by em...@apache.org on 2017/05/20 00:35:11 UTC
[2/4] incubator-ariatosca git commit: ARIA-148 Enhance CLI show
commands
ARIA-148 Enhance CLI show commands
* Allow "--all" flag to provide a complete dump
* Allow "--json" and "--yaml" flags for dump in those formats
* Support for node graph and type hierarchies
* Some fixes for YAML dump for our custom types
* Also closes ARIA-186: "aria services show" command
Project: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/commit/88ca2f35
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/88ca2f35
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/88ca2f35
Branch: refs/heads/ARIA-149-functions-in-operation-configuration
Commit: 88ca2f35e7d69b2bea17c588d4e239dd1e4d36d7
Parents: 78d6019
Author: Tal Liron <ta...@gmail.com>
Authored: Thu Apr 20 17:54:47 2017 -0500
Committer: Tal Liron <ta...@gmail.com>
Committed: Fri May 19 11:26:00 2017 -0500
----------------------------------------------------------------------
aria/cli/commands/service_templates.py | 29 ++++++++++++++++++++++++++
aria/cli/core/aria.py | 32 +++++++++++++++++++++++++++++
2 files changed, 61 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/88ca2f35/aria/cli/commands/service_templates.py
----------------------------------------------------------------------
diff --git a/aria/cli/commands/service_templates.py b/aria/cli/commands/service_templates.py
index d139195..56afff5 100644
--- a/aria/cli/commands/service_templates.py
+++ b/aria/cli/commands/service_templates.py
@@ -45,6 +45,7 @@ def service_templates():
@aria.argument('service-template-name')
@aria.options.verbose()
@aria.pass_model_storage
+<<<<<<< HEAD
@aria.options.service_template_mode_full
@aria.options.mode_types
@aria.options.format_json
@@ -52,12 +53,21 @@ def service_templates():
@aria.pass_logger
def show(service_template_name, model_storage, mode_full, mode_types, format_json, format_yaml,
logger):
+=======
+@aria.options.show_all
+@aria.options.show_types
+@aria.options.show_json
+@aria.options.show_yaml
+@aria.pass_logger
+def show(service_template_name, model_storage, all, types, json, yaml, logger):
+>>>>>>> ARIA-148 Enhance CLI show commands
"""Show information for a specific service template
`SERVICE_TEMPLATE_NAME` is the name of the service template to show information on.
"""
service_template = model_storage.service_template.get_by_name(service_template_name)
+<<<<<<< HEAD
if format_json or format_yaml:
mode_full = True
@@ -70,6 +80,20 @@ def show(service_template_name, model_storage, mode_full, mode_types, format_jso
else:
service_template.dump()
elif mode_types:
+=======
+ if json or yaml:
+ all = True
+
+ if all:
+ consumption.ConsumptionContext()
+ if json:
+ console.puts(formatting.json_dumps(collections.prune(service_template.as_raw)))
+ elif yaml:
+ console.puts(formatting.yaml_dumps(collections.prune(service_template.as_raw)))
+ else:
+ service_template.dump()
+ elif types:
+>>>>>>> ARIA-148 Enhance CLI show commands
consumption.ConsumptionContext()
service_template.dump_types()
else:
@@ -89,8 +113,13 @@ def show(service_template_name, model_storage, mode_full, mode_types, format_jso
if service_template.services:
logger.info('Existing services:')
+<<<<<<< HEAD
for service_name in service_template.services:
logger.info('\t{0}'.format(service_name))
+=======
+ for service in service_template.services:
+ logger.info('\t{0}'.format(service.name))
+>>>>>>> ARIA-148 Enhance CLI show commands
@service_templates.command(name='list',
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/88ca2f35/aria/cli/core/aria.py
----------------------------------------------------------------------
diff --git a/aria/cli/core/aria.py b/aria/cli/core/aria.py
index 56fe2f7..da7f2b4 100644
--- a/aria/cli/core/aria.py
+++ b/aria/cli/core/aria.py
@@ -346,6 +346,7 @@ class Options(object):
default=defaults.SERVICE_TEMPLATE_FILENAME,
help=helptexts.SERVICE_TEMPLATE_FILENAME)
+<<<<<<< HEAD
self.service_template_mode_full = mutually_exclusive_option(
'-f',
'--full',
@@ -405,6 +406,37 @@ class Options(object):
help=helptexts.SHOW_YAML,
mutuality_description='-j, --json',
mutuality_error=helptexts.FORMAT_MUTUALITY_ERROR_MESSAGE)
+=======
+ self.show_all = click.option(
+ '-a',
+ '--all',
+ is_flag=True,
+ help=helptexts.SHOW_ALL)
+
+ self.show_json = click.option(
+ '-j',
+ '--json',
+ is_flag=True,
+ help=helptexts.SHOW_JSON)
+
+ self.show_yaml = click.option(
+ '-y',
+ '--yaml',
+ is_flag=True,
+ help=helptexts.SHOW_YAML)
+
+ self.show_types = click.option(
+ '-t',
+ '--types',
+ is_flag=True,
+ help=helptexts.SHOW_TYPES)
+
+ self.show_graph = click.option(
+ '-g',
+ '--graph',
+ is_flag=True,
+ help=helptexts.SHOW_GRAPH)
+>>>>>>> ARIA-148 Enhance CLI show commands
@staticmethod
def verbose(expose_value=False):