diff --git a/tripleo_common/actions/parameters.py b/tripleo_common/actions/parameters.py index d7b7801f9..e646bfa8a 100644 --- a/tripleo_common/actions/parameters.py +++ b/tripleo_common/actions/parameters.py @@ -284,9 +284,10 @@ class GeneratePasswordsAction(base.TripleOAction): # We don't modify these to avoid changing defaults for pw_res in constants.LEGACY_HEAT_PASSWORD_RESOURCE_NAMES: try: - res = heat.resources.get(self.container, pw_res) param_defaults = stack_env.get('parameter_defaults', {}) - param_defaults[pw_res] = res.attributes['value'] + if pw_res not in param_defaults: + res = heat.resources.get(self.container, pw_res) + param_defaults[pw_res] = res.attributes['value'] except heat_exc.HTTPNotFound: LOG.debug('Heat resouce not found: %s' % pw_res) pass diff --git a/tripleo_common/tests/actions/test_parameters.py b/tripleo_common/tests/actions/test_parameters.py index 902f6b145..08c20e46e 100644 --- a/tripleo_common/tests/actions/test_parameters.py +++ b/tripleo_common/tests/actions/test_parameters.py @@ -964,6 +964,7 @@ class GeneratePasswordsActionTest(base.TestCase): existing_passwords = _EXISTING_PASSWORDS.copy() existing_passwords.pop("AdminPassword") + existing_passwords.pop("PcsdPassword") mock_ctx = mock.MagicMock() swift = mock.MagicMock(url="http://test.com") @@ -982,6 +983,7 @@ class GeneratePasswordsActionTest(base.TestCase): mock_orchestration.stacks.environment.return_value = { 'parameter_defaults': { 'AdminPassword': 'ExistingPasswordInHeat', + 'PcsdPassword': 'MyPassword', } } mock_resource = mock.MagicMock() @@ -998,6 +1000,7 @@ class GeneratePasswordsActionTest(base.TestCase): result = action.run(mock_ctx) existing_passwords["AdminPassword"] = "ExistingPasswordInHeat" + existing_passwords["PcsdPassword"] = "MyPassword" # ensure old passwords used and no new generation self.assertEqual(existing_passwords, result) mock_cache.assert_called_once_with(