diff --git a/tripleo_common/actions/scale.py b/tripleo_common/actions/scale.py index 3759ec0b2..f11ada314 100644 --- a/tripleo_common/actions/scale.py +++ b/tripleo_common/actions/scale.py @@ -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, diff --git a/tripleo_common/tests/actions/test_scale.py b/tripleo_common/tests/actions/test_scale.py index 5ff599681..7face5b90 100644 --- a/tripleo_common/tests/actions/test_scale.py +++ b/tripleo_common/tests/actions/test_scale.py @@ -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,