From a633536bfaa8909f453c26fa4f1be2bdb6792fb7 Mon Sep 17 00:00:00 2001 From: Pierre Riteau Date: Fri, 5 Jun 2020 12:58:15 +0200 Subject: [PATCH] Update openrc files after overcloud service upgrade We could end up with openrc files not matching the latest templates after an upgrade. Change-Id: I2dbaed7d698b630b1c79cf72fa338e29148dd6e7 --- kayobe/cli/commands.py | 8 ++++++++ kayobe/tests/unit/cli/test_commands.py | 12 ++++++++++++ .../notes/openrc-upgrade-9e14888d600f6839.yaml | 5 +++++ 3 files changed, 25 insertions(+) create mode 100644 releasenotes/notes/openrc-upgrade-9e14888d600f6839.yaml diff --git a/kayobe/cli/commands.py b/kayobe/cli/commands.py index a02619ebb..70224cd3f 100644 --- a/kayobe/cli/commands.py +++ b/kayobe/cli/commands.py @@ -1370,6 +1370,7 @@ class OvercloudServiceUpgrade(KollaAnsibleMixin, KayobeAnsibleMixin, deployment. * Perform a kolla-ansible upgrade of the overcloud services. * Configure and upgrade kayobe extra services. + * Regenerate openrc files for the admin user. This can be used in conjunction with the --tags and --kolla-tags arguments to upgrade specific services. @@ -1401,6 +1402,13 @@ class OvercloudServiceUpgrade(KollaAnsibleMixin, KayobeAnsibleMixin, self.run_kayobe_playbooks(parsed_args, playbooks, extra_vars=extra_vars, limit="overcloud") + # Post-deployment configuration. + self.run_kolla_ansible_overcloud(parsed_args, "post-deploy") + # Create an environment file for accessing the public API as the admin + # user. + playbooks = _build_playbook_list("public-openrc") + self.run_kayobe_playbooks(parsed_args, playbooks, ignore_limit=True) + class OvercloudServiceDestroy(KollaAnsibleMixin, KayobeAnsibleMixin, VaultMixin, Command): diff --git a/kayobe/tests/unit/cli/test_commands.py b/kayobe/tests/unit/cli/test_commands.py index 66452adda..7fa79fce8 100644 --- a/kayobe/tests/unit/cli/test_commands.py +++ b/kayobe/tests/unit/cli/test_commands.py @@ -1553,6 +1553,14 @@ class TestCase(unittest.TestCase): "kayobe_action": "upgrade", } ), + mock.call( + mock.ANY, + [ + utils.get_data_files_path("ansible", + "public-openrc.yml"), + ], + ignore_limit=True, + ), ] self.assertEqual(expected_calls, mock_run.call_args_list) @@ -1565,6 +1573,10 @@ class TestCase(unittest.TestCase): mock.ANY, "upgrade" ), + mock.call( + mock.ANY, + "post-deploy" + ), ] self.assertEqual(expected_calls, mock_kolla_run.call_args_list) diff --git a/releasenotes/notes/openrc-upgrade-9e14888d600f6839.yaml b/releasenotes/notes/openrc-upgrade-9e14888d600f6839.yaml new file mode 100644 index 000000000..86662ec95 --- /dev/null +++ b/releasenotes/notes/openrc-upgrade-9e14888d600f6839.yaml @@ -0,0 +1,5 @@ +--- +fixes: + - | + Kayobe now updates ``openrc`` files when using the ``kayobe overcloud service + upgrade`` command.