diff options
author | Jenkins <jenkins@review.openstack.org> | 2016-02-01 08:50:43 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2016-02-01 08:50:43 +0000 |
commit | 78e7bcd189771440345d0106d1e3dea1952a8724 (patch) | |
tree | 04a022011b94da002ed6b364d056de8c58323116 /heatclient/v1/shell.py | |
parent | 882d5654dde7450c866908298c25dcacd30b99f0 (diff) | |
parent | 6acd25e5d5085422ebbc325844f585f416941b6b (diff) | |
download | python-heatclient-78e7bcd189771440345d0106d1e3dea1952a8724.tar.gz |
Merge "Raise CommandError when Any of stack/deployment/config delete failed"
Diffstat (limited to 'heatclient/v1/shell.py')
-rw-r--r-- | heatclient/v1/shell.py | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/heatclient/v1/shell.py b/heatclient/v1/shell.py index b8c6e1e..92803a6 100644 --- a/heatclient/v1/shell.py +++ b/heatclient/v1/shell.py @@ -284,9 +284,11 @@ def do_stack_delete(hc, args): except exc.HTTPNotFound as e: failure_count += 1 print(e) - if failure_count == len(args.id): - raise exc.CommandError(_("Unable to delete any of the specified " - "stacks.")) + if failure_count: + raise exc.CommandError(_("Unable to delete %(count)d of the %(total)d " + "stacks.") % + {'count': failure_count, + 'total': len(args.id)}) do_stack_list(hc) @@ -1266,20 +1268,22 @@ def do_config_show(hc, args): @utils.arg('id', metavar='<ID>', nargs='+', - help=_('IDs of the configurations to delete.')) + help=_('ID of the configuration(s) to delete.')) def do_config_delete(hc, args): - '''Delete a software configuration.''' + '''Delete the software configuration(s).''' failure_count = 0 for config_id in args.id: try: hc.software_configs.delete(config_id=config_id) - except exc.HTTPNotFound as e: + except exc.HTTPNotFound: failure_count += 1 - print(e) - if failure_count == len(args.id): - raise exc.CommandError(_("Unable to delete any of the specified " - "configs.")) + print(_('Software config with ID %s not found') % config_id) + if failure_count: + raise exc.CommandError(_("Unable to delete %(count)d of the %(total)d " + "configs.") % + {'count': failure_count, + 'total': len(args.id)}) @utils.arg('-i', '--input-value', metavar='<KEY=VALUE>', @@ -1377,9 +1381,9 @@ def do_deployment_metadata_show(hc, args): @utils.arg('id', metavar='<ID>', nargs='+', - help=_('IDs of the deployments to delete.')) + help=_('ID of the deployment(s) to delete.')) def do_deployment_delete(hc, args): - '''Delete software deployments.''' + '''Delete the software deployment(s).''' failure_count = 0 for deploy_id in args.id: @@ -1401,9 +1405,10 @@ def do_deployment_delete(hc, args): '%(config_id)s of deployment %(deploy_id)s') % {'config_id': config_id, 'deploy_id': deploy_id}) - if failure_count == len(args.id): - raise exc.CommandError(_("Unable to delete any of the specified " - "deployments.")) + if failure_count: + raise exc.CommandError(_("Unable to delete %(count)d of the %(total)d " + "deployments.") % + {'count': failure_count, 'total': len(args.id)}) @utils.arg('id', metavar='<ID>', |