[jira] [Commented] (ARIA-148) Enhance CLI "show" commands
[ https://issues.apache.org/jira/browse/ARIA-148?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16007043#comment-16007043 ] ASF subversion and git services commented on ARIA-148: -- Commit fdd57c47acfe63dc25c6f20bcb3785225b3f774d in incubator-ariatosca's branch refs/heads/master from [~emblemparade] [ https://git-wip-us.apache.org/repos/asf?p=incubator-ariatosca.git;h=fdd57c4 ] ARIA-148 Enhance CLI show commands * Allow "--full" 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 > Enhance CLI "show" commands > --- > > Key: ARIA-148 > URL: https://issues.apache.org/jira/browse/ARIA-148 > Project: AriaTosca > Issue Type: Story >Reporter: Tal Liron >Assignee: Tal Liron > > For {{aria service-templates show}} and {{aria services show}} add support > for dumping, including graphs and type hierarchies, in JSON and YAML. -- This message was sent by Atlassian JIRA (v6.3.15#6346)
[jira] [Commented] (ARIA-148) Enhance CLI "show" commands
[ https://issues.apache.org/jira/browse/ARIA-148?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16006893#comment-16006893 ] ASF subversion and git services commented on ARIA-148: -- Commit fdd57c47acfe63dc25c6f20bcb3785225b3f774d in incubator-ariatosca's branch refs/heads/ARIA-148-extra-cli-commands from [~emblemparade] [ https://git-wip-us.apache.org/repos/asf?p=incubator-ariatosca.git;h=fdd57c4 ] ARIA-148 Enhance CLI show commands * Allow "--full" 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 > Enhance CLI "show" commands > --- > > Key: ARIA-148 > URL: https://issues.apache.org/jira/browse/ARIA-148 > Project: AriaTosca > Issue Type: Story >Reporter: Tal Liron >Assignee: Tal Liron > > For {{aria service-templates show}} and {{aria services show}} add support > for dumping, including graphs and type hierarchies, in JSON and YAML. -- This message was sent by Atlassian JIRA (v6.3.15#6346)
[jira] [Commented] (ARIA-148) Enhance CLI "show" commands
[ https://issues.apache.org/jira/browse/ARIA-148?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16006109#comment-16006109 ] ASF GitHub Bot commented on ARIA-148: - Github user ran-z commented on a diff in the pull request: https://github.com/apache/incubator-ariatosca/pull/107#discussion_r115935686 --- Diff: aria/cli/core/aria.py --- @@ -65,15 +58,33 @@ def __init__(self, *args, **kwargs): super(MutuallyExclusiveOption, self).__init__(*args, **kwargs) def handle_parse_result(self, ctx, opts, args): -if self.mutually_exclusive.intersection(opts) and self.name in opts: +if (self.name in opts) and self.mutually_exclusive.keys().intersection(opts): raise click.UsageError( 'Illegal usage: `{0}` is mutually exclusive with ' 'arguments: [{1}] ({2}).'.format( self.name, self.mutuality_string, self.mutuality_error_message)) -return super(MutuallyExclusiveOption, self).handle_parse_result( -ctx, opts, args) +return super(MutuallyExclusiveOption, self).handle_parse_result(ctx, opts, args) + + +def mutually_exclusive_option(*param_decls, **attrs): +""" +Makes options mutually exclusive. The decorator must pass a a ``mutually_exclusive`` argument +with a list of argument names with which the option is mutually exclusive. + +NOTE: All mutually exclusive options must use this. It's not enough to use it in just one of the +options. +""" +def decorator(func): +if 'help' in attrs: --- End diff -- could you please document this func a bit more? I'm not sure what are `param_decls` and `attrs` in this case, why `help` is being inspected, and why the internal `__click_params__` is accessed directly here. > Enhance CLI "show" commands > --- > > Key: ARIA-148 > URL: https://issues.apache.org/jira/browse/ARIA-148 > Project: AriaTosca > Issue Type: Story >Reporter: Tal Liron >Assignee: Tal Liron > > For {{aria service-templates show}} and {{aria services show}} add support > for dumping, including graphs and type hierarchies, in JSON and YAML. -- This message was sent by Atlassian JIRA (v6.3.15#6346)
[jira] [Commented] (ARIA-148) Enhance CLI "show" commands
[ https://issues.apache.org/jira/browse/ARIA-148?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16006110#comment-16006110 ] ASF GitHub Bot commented on ARIA-148: - Github user ran-z commented on a diff in the pull request: https://github.com/apache/incubator-ariatosca/pull/107#discussion_r115934893 --- Diff: aria/cli/core/aria.py --- @@ -40,16 +41,8 @@ class MutuallyExclusiveOption(click.Option): -"""Makes options mutually exclusive. The option must pass a `cls` argument -with this class name and a `mutually_exclusive` argument with a list of -argument names it is mutually exclusive with. - -NOTE: All mutually exclusive options must use this. It's not enough to -use it in just one of the options. -""" - def __init__(self, *args, **kwargs): -self.mutually_exclusive = set(kwargs.pop('mutually_exclusive', [])) +self.mutually_exclusive = kwargs.pop('mutually_exclusive', tuple()) --- End diff -- why change this from a set to another type? > Enhance CLI "show" commands > --- > > Key: ARIA-148 > URL: https://issues.apache.org/jira/browse/ARIA-148 > Project: AriaTosca > Issue Type: Story >Reporter: Tal Liron >Assignee: Tal Liron > > For {{aria service-templates show}} and {{aria services show}} add support > for dumping, including graphs and type hierarchies, in JSON and YAML. -- This message was sent by Atlassian JIRA (v6.3.15#6346)
[jira] [Commented] (ARIA-148) Enhance CLI "show" commands
[ https://issues.apache.org/jira/browse/ARIA-148?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16006113#comment-16006113 ] ASF GitHub Bot commented on ARIA-148: - Github user ran-z commented on a diff in the pull request: https://github.com/apache/incubator-ariatosca/pull/107#discussion_r115935090 --- Diff: aria/cli/core/aria.py --- @@ -65,15 +58,33 @@ def __init__(self, *args, **kwargs): super(MutuallyExclusiveOption, self).__init__(*args, **kwargs) def handle_parse_result(self, ctx, opts, args): -if self.mutually_exclusive.intersection(opts) and self.name in opts: +if (self.name in opts) and self.mutually_exclusive.keys().intersection(opts): raise click.UsageError( 'Illegal usage: `{0}` is mutually exclusive with ' 'arguments: [{1}] ({2}).'.format( self.name, self.mutuality_string, self.mutuality_error_message)) -return super(MutuallyExclusiveOption, self).handle_parse_result( -ctx, opts, args) +return super(MutuallyExclusiveOption, self).handle_parse_result(ctx, opts, args) + + +def mutually_exclusive_option(*param_decls, **attrs): +""" +Makes options mutually exclusive. The decorator must pass a a ``mutually_exclusive`` argument --- End diff -- a a a a a > Enhance CLI "show" commands > --- > > Key: ARIA-148 > URL: https://issues.apache.org/jira/browse/ARIA-148 > Project: AriaTosca > Issue Type: Story >Reporter: Tal Liron >Assignee: Tal Liron > > For {{aria service-templates show}} and {{aria services show}} add support > for dumping, including graphs and type hierarchies, in JSON and YAML. -- This message was sent by Atlassian JIRA (v6.3.15#6346)
[jira] [Commented] (ARIA-148) Enhance CLI "show" commands
[ https://issues.apache.org/jira/browse/ARIA-148?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16006111#comment-16006111 ] ASF GitHub Bot commented on ARIA-148: - Github user ran-z commented on a diff in the pull request: https://github.com/apache/incubator-ariatosca/pull/107#discussion_r115934967 --- Diff: aria/cli/core/aria.py --- @@ -65,15 +58,33 @@ def __init__(self, *args, **kwargs): super(MutuallyExclusiveOption, self).__init__(*args, **kwargs) def handle_parse_result(self, ctx, opts, args): -if self.mutually_exclusive.intersection(opts) and self.name in opts: +if (self.name in opts) and self.mutually_exclusive.keys().intersection(opts): --- End diff -- seems like `mutually_exclusive` might be a `tuple` now, so `.keys()` would raise an error here. > Enhance CLI "show" commands > --- > > Key: ARIA-148 > URL: https://issues.apache.org/jira/browse/ARIA-148 > Project: AriaTosca > Issue Type: Story >Reporter: Tal Liron >Assignee: Tal Liron > > For {{aria service-templates show}} and {{aria services show}} add support > for dumping, including graphs and type hierarchies, in JSON and YAML. -- This message was sent by Atlassian JIRA (v6.3.15#6346)
[jira] [Commented] (ARIA-148) Enhance CLI "show" commands
[ https://issues.apache.org/jira/browse/ARIA-148?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16006112#comment-16006112 ] ASF GitHub Bot commented on ARIA-148: - Github user ran-z commented on a diff in the pull request: https://github.com/apache/incubator-ariatosca/pull/107#discussion_r115934648 --- Diff: aria/cli/core/aria.py --- @@ -325,6 +339,46 @@ def __init__(self): default=defaults.SERVICE_TEMPLATE_FILENAME, help=helptexts.SERVICE_TEMPLATE_FILENAME) +self.show_full = click.option( +'-f', +'--full', +'mode', +is_flag=True, +flag_value='full', --- End diff -- I think I don't like this approach as much at the previous one. It seems like it simplifies the code a bit but makes things somewhat more confusing to the user - specifically the fact that only the last flag of a given "destination" (e.g. `mode`) takes hold. If instead you have different destinations for these flags, it'd be easier to inform the user of misuse (even if for some reason the mutually-exclusive mechanism is problematic to use, you can always just manually validate the parameters in the command function itself) > Enhance CLI "show" commands > --- > > Key: ARIA-148 > URL: https://issues.apache.org/jira/browse/ARIA-148 > Project: AriaTosca > Issue Type: Story >Reporter: Tal Liron >Assignee: Tal Liron > > For {{aria service-templates show}} and {{aria services show}} add support > for dumping, including graphs and type hierarchies, in JSON and YAML. -- This message was sent by Atlassian JIRA (v6.3.15#6346)
[jira] [Commented] (ARIA-148) Enhance CLI "show" commands
[ https://issues.apache.org/jira/browse/ARIA-148?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16005790#comment-16005790 ] ASF subversion and git services commented on ARIA-148: -- Commit 82193541de80f719ebf9673700343d1ad702cb2d in incubator-ariatosca's branch refs/heads/ARIA-148-extra-cli-commands from [~emblemparade] [ https://git-wip-us.apache.org/repos/asf?p=incubator-ariatosca.git;h=8219354 ] ARIA-148 Enhance CLI show commands * Allow "--full" 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 > Enhance CLI "show" commands > --- > > Key: ARIA-148 > URL: https://issues.apache.org/jira/browse/ARIA-148 > Project: AriaTosca > Issue Type: Story >Reporter: Tal Liron >Assignee: Tal Liron > > For {{aria service-templates show}} and {{aria services show}} add support > for dumping, including graphs and type hierarchies, in JSON and YAML. -- This message was sent by Atlassian JIRA (v6.3.15#6346)
[jira] [Commented] (ARIA-148) Enhance CLI "show" commands
[ https://issues.apache.org/jira/browse/ARIA-148?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16005691#comment-16005691 ] ASF subversion and git services commented on ARIA-148: -- Commit 990a79230171d50a600e6f256ab90d45f187fe0e in incubator-ariatosca's branch refs/heads/ARIA-148-extra-cli-commands from [~emblemparade] [ https://git-wip-us.apache.org/repos/asf?p=incubator-ariatosca.git;h=990a792 ] 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 > Enhance CLI "show" commands > --- > > Key: ARIA-148 > URL: https://issues.apache.org/jira/browse/ARIA-148 > Project: AriaTosca > Issue Type: Story >Reporter: Tal Liron >Assignee: Tal Liron > > For {{aria service-templates show}} and {{aria services show}} add support > for dumping, including graphs and type hierarchies, in JSON and YAML. -- This message was sent by Atlassian JIRA (v6.3.15#6346)
[jira] [Commented] (ARIA-148) Enhance CLI "show" commands
[ https://issues.apache.org/jira/browse/ARIA-148?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16004622#comment-16004622 ] ASF GitHub Bot commented on ARIA-148: - Github user ran-z commented on a diff in the pull request: https://github.com/apache/incubator-ariatosca/pull/107#discussion_r115729149 --- Diff: aria/cli/commands/service_templates.py --- @@ -43,32 +45,51 @@ def service_templates(): @aria.argument('service-template-name') @aria.options.verbose() @aria.pass_model_storage +@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, logger): -"""Show information for a specific service templates +def show(service_template_name, model_storage, all, types, json, yaml, logger): +"""Show information for a specific service template `SERVICE_TEMPLATE_NAME` is the name of the service template to show information on. """ -logger.info('Showing service template {0}...'.format(service_template_name)) service_template = model_storage.service_template.get_by_name(service_template_name) -service_template_dict = service_template.to_dict() -service_template_dict['#services'] = len(service_template.services) -column_formatters = \ - dict(description=table.trim_formatter_generator(DESCRIPTION_FIELD_LENGTH_LIMIT)) -columns = SERVICE_TEMPLATE_COLUMNS + ['#services'] -table.print_data(columns, service_template_dict, 'Service-template:', - column_formatters=column_formatters, col_max_width=50) - -if service_template_dict['description'] is not None: -logger.info('Description:') - logger.info('{0}{1}'.format(service_template_dict['description'].encode('UTF-8') or '', -os.linesep)) - -if service_template.services: -logger.info('Existing services:') -for service in service_template.services: -logger.info('\t{0}'.format(service.name)) +if json or yaml: --- End diff -- i'm a bit confused by this. so `yaml`, `json`, and `all` all mean all, and `json` and `yaml` can be used simulatniously but only `json` will get printed. Re the latter problem, please have a look at `aria.py` for how to make flags mutually-exclusive. re the former, it might be better to also have the `all` flag as mutually-exclusive with the other two.. > Enhance CLI "show" commands > --- > > Key: ARIA-148 > URL: https://issues.apache.org/jira/browse/ARIA-148 > Project: AriaTosca > Issue Type: Story >Reporter: Tal Liron >Assignee: Tal Liron > > For {{aria service-templates show}} and {{aria services show}} add support > for dumping, including graphs and type hierarchies, in JSON and YAML. -- This message was sent by Atlassian JIRA (v6.3.15#6346)
[jira] [Commented] (ARIA-148) Enhance CLI "show" commands
[ https://issues.apache.org/jira/browse/ARIA-148?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16004603#comment-16004603 ] ASF GitHub Bot commented on ARIA-148: - Github user ran-z commented on a diff in the pull request: https://github.com/apache/incubator-ariatosca/pull/107#discussion_r115726284 --- Diff: aria/cli/table.py --- @@ -85,7 +85,7 @@ def get_values_per_column(column, row_data): return val else: -return defaults[column] +return defaults.get(column) if defaults is not None else None --- End diff -- should instead have a `defaults = defaults or {}` before calling the nested method > Enhance CLI "show" commands > --- > > Key: ARIA-148 > URL: https://issues.apache.org/jira/browse/ARIA-148 > Project: AriaTosca > Issue Type: Story >Reporter: Tal Liron >Assignee: Tal Liron > > For {{aria service-templates show}} and {{aria services show}} add support > for dumping, including graphs and type hierarchies, in JSON and YAML. -- This message was sent by Atlassian JIRA (v6.3.15#6346)
[jira] [Commented] (ARIA-148) Enhance CLI "show" commands
[ https://issues.apache.org/jira/browse/ARIA-148?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16004602#comment-16004602 ] ASF GitHub Bot commented on ARIA-148: - Github user ran-z commented on a diff in the pull request: https://github.com/apache/incubator-ariatosca/pull/107#discussion_r115726390 --- Diff: aria/cli/commands/services.py --- @@ -38,6 +41,53 @@ def services(): pass +@services.command(name='show', + short_help='Display service information') +@aria.argument('service-name') +@aria.options.verbose() +@aria.options.show_all +@aria.options.show_graph +@aria.options.show_json +@aria.options.show_yaml +@aria.pass_model_storage +@aria.pass_logger +def show(service_name, model_storage, all, graph, json, yaml, logger): +"""Show information for a specific service template + +`SERVICE_NAME` is the name of the service to display information on. +""" +logger.info('Showing service {0}...'.format(service_name)) +service = model_storage.service.get_by_name(service_name) + +if json or yaml: +all = True --- End diff -- i'd rename the flag, it's both unclear and a python keyword. `show_all` or `all_info` might be better. > Enhance CLI "show" commands > --- > > Key: ARIA-148 > URL: https://issues.apache.org/jira/browse/ARIA-148 > Project: AriaTosca > Issue Type: Story >Reporter: Tal Liron >Assignee: Tal Liron > > For {{aria service-templates show}} and {{aria services show}} add support > for dumping, including graphs and type hierarchies, in JSON and YAML. -- This message was sent by Atlassian JIRA (v6.3.15#6346)
[jira] [Commented] (ARIA-148) Enhance CLI "show" commands
[ https://issues.apache.org/jira/browse/ARIA-148?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16003550#comment-16003550 ] ASF subversion and git services commented on ARIA-148: -- Commit 7e75948fb7aaf60c48cf2be4763ccbba0463f4bd in incubator-ariatosca's branch refs/heads/ARIA-148-extra-cli-commands from [~emblemparade] [ https://git-wip-us.apache.org/repos/asf?p=incubator-ariatosca.git;h=7e75948 ] 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 > Enhance CLI "show" commands > --- > > Key: ARIA-148 > URL: https://issues.apache.org/jira/browse/ARIA-148 > Project: AriaTosca > Issue Type: Story >Reporter: Tal Liron >Assignee: Tal Liron > > For {{aria service-templates show}} and {{aria services show}} add support > for dumping, including graphs and type hierarchies, in JSON and YAML. -- This message was sent by Atlassian JIRA (v6.3.15#6346)
[jira] [Commented] (ARIA-148) Enhance CLI "show" commands
[ https://issues.apache.org/jira/browse/ARIA-148?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16002871#comment-16002871 ] ASF subversion and git services commented on ARIA-148: -- Commit 7442a7661cb71f1ed794e99ab8e3529590116e91 in incubator-ariatosca's branch refs/heads/ARIA-148-extra-cli-commands from [~emblemparade] [ https://git-wip-us.apache.org/repos/asf?p=incubator-ariatosca.git;h=7442a76 ] ARIA-148 Enhance CLI show commands > Enhance CLI "show" commands > --- > > Key: ARIA-148 > URL: https://issues.apache.org/jira/browse/ARIA-148 > Project: AriaTosca > Issue Type: Story >Reporter: Tal Liron >Assignee: Tal Liron > > For {{aria service-templates show}} and {{aria services show}} add support > for dumping, including graphs and type hierarchies, in JSON and YAML. -- This message was sent by Atlassian JIRA (v6.3.15#6346)
[jira] [Commented] (ARIA-148) Enhance CLI "show" commands
[ https://issues.apache.org/jira/browse/ARIA-148?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16002849#comment-16002849 ] ASF subversion and git services commented on ARIA-148: -- Commit 662241e0a972c2a21da0de92138850fb9448b29d in incubator-ariatosca's branch refs/heads/ARIA-148-extra-cli-commands from [~emblemparade] [ https://git-wip-us.apache.org/repos/asf?p=incubator-ariatosca.git;h=662241e ] ARIA-148 Enhance CLI show commands > Enhance CLI "show" commands > --- > > Key: ARIA-148 > URL: https://issues.apache.org/jira/browse/ARIA-148 > Project: AriaTosca > Issue Type: Story >Reporter: Tal Liron >Assignee: Tal Liron > > For {{aria service-templates show}} and {{aria services show}} add support > for dumping, including graphs and type hierarchies, in JSON and YAML. -- This message was sent by Atlassian JIRA (v6.3.15#6346)
[jira] [Commented] (ARIA-148) Enhance CLI "show" commands
[ https://issues.apache.org/jira/browse/ARIA-148?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16001294#comment-16001294 ] ASF subversion and git services commented on ARIA-148: -- Commit 57eeb7162af01d5955dcc0ed443533682ed4c9d2 in incubator-ariatosca's branch refs/heads/ARIA-148-extra-cli-commands from [~emblemparade] [ https://git-wip-us.apache.org/repos/asf?p=incubator-ariatosca.git;h=57eeb71 ] ARIA-148 Add CLI display commands > Enhance CLI "show" commands > --- > > Key: ARIA-148 > URL: https://issues.apache.org/jira/browse/ARIA-148 > Project: AriaTosca > Issue Type: Story >Reporter: Tal Liron >Assignee: Tal Liron > > For {{aria service-templates show}} and {{aria services show}} add support > for dumping, including graphs and type hierarchies, in JSON and YAML. -- This message was sent by Atlassian JIRA (v6.3.15#6346)
[jira] [Commented] (ARIA-148) Enhance CLI "show" commands
[ https://issues.apache.org/jira/browse/ARIA-148?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15999732#comment-15999732 ] Ran Ziv commented on ARIA-148: -- If ARIA-186 is to be contained in this, then this ticket needs to also be about having the standard {{show}} display for {{services}}, beyond the additional graph, dump, etc. flags > Enhance CLI "show" commands > --- > > Key: ARIA-148 > URL: https://issues.apache.org/jira/browse/ARIA-148 > Project: AriaTosca > Issue Type: Story >Reporter: Tal Liron >Assignee: Tal Liron > > For {{aria service-templates show}} and {{aria services show}} add support > for dumping, including graphs and type hierarchies, in JSON and YAML. -- This message was sent by Atlassian JIRA (v6.3.15#6346)