summaryrefslogtreecommitdiff
path: root/heatclient/osc
diff options
context:
space:
mode:
Diffstat (limited to 'heatclient/osc')
-rw-r--r--heatclient/osc/v1/stack.py42
1 files changed, 28 insertions, 14 deletions
diff --git a/heatclient/osc/v1/stack.py b/heatclient/osc/v1/stack.py
index 4a64221..89540d2 100644
--- a/heatclient/osc/v1/stack.py
+++ b/heatclient/osc/v1/stack.py
@@ -233,6 +233,10 @@ class UpdateStack(command.ShowOne):
'would be changed')
)
parser.add_argument(
+ '--show-nested', default=False, action="store_true",
+ help=_('Show nested stacks when performing --dry-run')
+ )
+ parser.add_argument(
'--parameter', metavar='<key=value>',
help=_('Parameter values used to create the stack. '
'This can be specified multiple times'),
@@ -335,6 +339,9 @@ class UpdateStack(command.ShowOne):
fields['disable_rollback'] = rollback == 'disabled'
if parsed_args.dry_run:
+ if parsed_args.show_nested:
+ fields['show_nested'] = parsed_args.show_nested
+
changes = client.stacks.preview_update(**fields)
fields = ['state', 'resource_name', 'resource_type',
@@ -684,9 +691,9 @@ class DeleteStack(command.Command):
try:
if not parsed_args.yes and sys.stdin.isatty():
- sys.stdout.write(
- _("Are you sure you want to delete this stack(s) [y/N]? "))
- prompt_response = sys.stdin.readline().lower()
+ prompt_response = six.moves.input(
+ _("Are you sure you want to delete this stack(s) [y/N]? ")
+ ).lower()
if not prompt_response.startswith('y'):
self.log.info('User did not confirm stack delete so '
'taking no action.')
@@ -994,11 +1001,6 @@ class OutputShowStack(command.ShowOne):
msg = _('Output error: %s') % output['output_error']
raise exc.CommandError(msg)
- if (isinstance(output['output_value'], list) or
- isinstance(output['output_value'], dict)):
- output['output_value'] = heat_utils.json_formatter(
- output['output_value'])
-
return self.dict2columns(output)
@@ -1208,16 +1210,23 @@ class CancelStack(StackActionBase):
Supported tasks for cancellation:
* update
+ * create
"""
log = logging.getLogger(__name__ + '.CancelStack')
def get_parser(self, prog_name):
- return self._get_parser(
+ parser = self._get_parser(
prog_name,
_('Stack(s) to cancel (name or ID)'),
- _('Wait for check to complete')
+ _('Wait for cancel to complete')
)
+ parser.add_argument(
+ '--no-rollback',
+ action='store_true',
+ help=_('Cancel without rollback')
+ )
+ return parser
def take_action(self, parsed_args):
self.log.debug("take_action(%s)", parsed_args)
@@ -1230,20 +1239,25 @@ class CancelStack(StackActionBase):
'Updated Time'
]
heat_client = self.app.client_manager.orchestration
-
+ if parsed_args.no_rollback:
+ action = heat_client.actions.cancel_without_rollback
+ allowed_statuses = ['create_in_progress',
+ 'update_in_progress']
+ else:
+ action = heat_client.actions.cancel_update
+ allowed_statuses = ['update_in_progress']
for stack in parsed_args.stack:
try:
data = heat_client.stacks.get(stack_id=stack)
except heat_exc.HTTPNotFound:
raise exc.CommandError('Stack not found: %s' % stack)
-
status = getattr(data, 'stack_status').lower()
- if status == 'update_in_progress':
+ if status in allowed_statuses:
data = _stack_action(
stack,
parsed_args,
heat_client,
- heat_client.actions.cancel_update
+ action
)
rows += [utils.get_dict_properties(data.to_dict(), columns)]
else: