diff --git a/tripleo_common/actions/parameters.py b/tripleo_common/actions/parameters.py index 61eb48a18..d77c3b893 100644 --- a/tripleo_common/actions/parameters.py +++ b/tripleo_common/actions/parameters.py @@ -264,9 +264,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 1c7a20dff..717079f79 100644 --- a/tripleo_common/tests/actions/test_parameters.py +++ b/tripleo_common/tests/actions/test_parameters.py @@ -733,6 +733,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") @@ -751,6 +752,7 @@ class GeneratePasswordsActionTest(base.TestCase): mock_orchestration.stacks.environment.return_value = { 'parameter_defaults': { 'AdminPassword': 'ExistingPasswordInHeat', + 'PcsdPassword': 'MyPassword', } } mock_get_orchestration_client.return_value = mock_orchestration @@ -759,6 +761,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(