Fix overcloud node delete after an upgrade

In fbc435ce16, we stopped passing
'parameters' to stack update call. This is backward incompatible
as the 'parameters' set for the stack before an upgrade would take
precedence over the ones set in 'parameter_defaults' of plan env.

Change-Id: Ia1d823386da687154c433136bf22ae6a0291573d
Closes-Bug: #1749636
This commit is contained in:
rabi 2018-02-15 10:09:54 +05:30
parent 0eb3341486
commit 7213aa5669
2 changed files with 11 additions and 8 deletions

View File

@ -83,6 +83,11 @@ class ScaleDownAction(templates.ProcessTemplatesAction):
fields = processed_data.copy()
fields['timeout_mins'] = timeout_mins
fields['existing'] = True
# As we do a PATCH update when deleting nodes, parameters set for a
# stack before upgrade to newton (ex. ComputeRemovalPolicies),
# would still take precedence over the ones set in parameter_defaults
# after upgrade. Clear these parameters for backward compatibility.
fields['clear_parameters'] = list(parameters.keys())
LOG.debug('stack update params: %s', fields)
self.get_orchestration_client(context).stacks.update(self.container,

View File

@ -139,14 +139,12 @@ class ScaleDownActionTest(base.TestCase):
template={'heat_template_version': '2016-04-30'}
)
heatclient.stacks.update.assert_called_once_with(
'stack',
stack_name='stack',
template={'heat_template_version': '2016-04-30'},
environment=env,
existing=True,
files={},
timeout_mins=240)
clear_list = list(['ComputeCount', 'ComputeRemovalPolicies'])
_, kwargs = heatclient.stacks.update.call_args
self.assertEqual(set(kwargs['clear_parameters']), set(clear_list))
self.assertEqual(kwargs['environment'], env)
self.assertEqual(kwargs['existing'], True)
self.assertEqual(kwargs['files'], {})
mock_cache.assert_called_with(
mock_ctx,