Support --show-nested in openstack stack update --dry-run
Added --show-nested support in `openstack stack update`. The work is based on `heat stack-update` implementation. Closes-Bug: #1720085 Change-Id: I50c8f5ac9ba4cb7e478af03ff4c1f099270ae226
This commit is contained in:
parent
0bfb7899b2
commit
2a39275ec3
@ -232,6 +232,10 @@ class UpdateStack(command.ShowOne):
|
|||||||
help=_('Do not actually perform the stack update, but show what '
|
help=_('Do not actually perform the stack update, but show what '
|
||||||
'would be changed')
|
'would be changed')
|
||||||
)
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
'--show-nested', default=False, action="store_true",
|
||||||
|
help=_('Show nested stacks when performing --dry-run')
|
||||||
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--parameter', metavar='<key=value>',
|
'--parameter', metavar='<key=value>',
|
||||||
help=_('Parameter values used to create the stack. '
|
help=_('Parameter values used to create the stack. '
|
||||||
@ -335,6 +339,9 @@ class UpdateStack(command.ShowOne):
|
|||||||
fields['disable_rollback'] = rollback == 'disabled'
|
fields['disable_rollback'] = rollback == 'disabled'
|
||||||
|
|
||||||
if parsed_args.dry_run:
|
if parsed_args.dry_run:
|
||||||
|
if parsed_args.show_nested:
|
||||||
|
fields['show_nested'] = parsed_args.show_nested
|
||||||
|
|
||||||
changes = client.stacks.preview_update(**fields)
|
changes = client.stacks.preview_update(**fields)
|
||||||
|
|
||||||
fields = ['state', 'resource_name', 'resource_type',
|
fields = ['state', 'resource_name', 'resource_type',
|
||||||
|
@ -335,6 +335,17 @@ class TestStackUpdate(TestStack):
|
|||||||
self.stack_client.preview_update.assert_called_with(**self.defaults)
|
self.stack_client.preview_update.assert_called_with(**self.defaults)
|
||||||
self.stack_client.update.assert_not_called()
|
self.stack_client.update.assert_not_called()
|
||||||
|
|
||||||
|
def test_stack_update_dry_run_show_nested(self):
|
||||||
|
arglist = ['my_stack', '-t', self.template_path, '--dry-run',
|
||||||
|
'--show-nested']
|
||||||
|
parsed_args = self.check_parser(self.cmd, arglist, [])
|
||||||
|
|
||||||
|
self.cmd.take_action(parsed_args)
|
||||||
|
|
||||||
|
self.stack_client.preview_update.assert_called_with(
|
||||||
|
show_nested=True, **self.defaults)
|
||||||
|
self.stack_client.update.assert_not_called()
|
||||||
|
|
||||||
@mock.patch('heatclient.common.event_utils.poll_for_events',
|
@mock.patch('heatclient.common.event_utils.poll_for_events',
|
||||||
return_value=('UPDATE_COMPLETE',
|
return_value=('UPDATE_COMPLETE',
|
||||||
'Stack my_stack UPDATE_COMPLETE'))
|
'Stack my_stack UPDATE_COMPLETE'))
|
||||||
|
Loading…
Reference in New Issue
Block a user