From c3d0948c4ba0b41c5375ac00007115e6e2635369 Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Wed, 26 Aug 2026 17:39:45 +0000 Subject: [PATCH 1/5] fix(sunbeam-python): skip endpoint prompt when manifest omits optional endpoints field --- sunbeam-python/sunbeam/steps/openstack.py | 5 +- .../unit/sunbeam/steps/test_openstack.py | 86 +++++++++++++++++++ 2 files changed, 90 insertions(+), 1 deletion(-) diff --git a/sunbeam-python/sunbeam/steps/openstack.py b/sunbeam-python/sunbeam/steps/openstack.py index 59dad008d..dbea89dd0 100644 --- a/sunbeam-python/sunbeam/steps/openstack.py +++ b/sunbeam-python/sunbeam/steps/openstack.py @@ -1215,7 +1215,10 @@ def prompt( show_hint=show_hint, ) - self.variables["configure"] = configure_endpoint_bank.configure.ask() + if self.manifest is None and not self.accept_defaults: + self.variables["configure"] = configure_endpoint_bank.configure.ask() + else: + self.variables["configure"] = preseed.get("configure", False) if not self.variables["configure"]: # Clear all endpoint data when user chooses not to configure endpoints diff --git a/sunbeam-python/tests/unit/sunbeam/steps/test_openstack.py b/sunbeam-python/tests/unit/sunbeam/steps/test_openstack.py index ad25254fa..7291c3beb 100644 --- a/sunbeam-python/tests/unit/sunbeam/steps/test_openstack.py +++ b/sunbeam-python/tests/unit/sunbeam/steps/test_openstack.py @@ -38,6 +38,7 @@ OpenStackPatchLoadBalancerServicesIPStep, ReapplyOpenStackTerraformPlanStep, UpdateOpenStackModelConfigStep, + EndpointsConfigurationStep, compute_ha_scale, compute_ingress_scale, compute_os_api_scale, @@ -1968,3 +1969,88 @@ def test_charm_not_in_manifest(self, manifest_read_config, snap): ) assert result == [] + + +class TestEndpointsConfigurationStepPrompt: + """Tests for the endpoints promp-skip fix.""" + + def _make_step(self, manifest=None, accept_defaults=False, client=None): + client = client or Mock() + step = EndpointsConfigurationStep( + client=client, + manifest=manifest, + accept_defaults=accept_defaults, + ) + return step + + @patch("sunbeam.steps.openstack.INGRESS_ENDPOINT_TYPES", []) + @patch("sunbeam.steps.openstack.load_answers") + @patch("sunbeam.steps.openstack.QuestionBank") + def test_no_manifest_no_accept_defaults_prompts_interactively( + self, mock_question_bank, mock_load_answers + ): + """With no manifest and no --accept-defaults, the user should be asked.""" + mock_load_answers.return_value = {} + mock_bank_instance = mock_question_bank.return_value + mock_bank_instance.configure.ask.return_value = True + + step = self._make_step(manifest=None, accept_defaults=False) + step.prompt(console=None) + + mock_bank_instance.configure.ask.assert_called_once() + assert step.variables["configure"] is True + + @patch("sunbeam.steps.openstack.INGRESS_ENDPOINT_TYPES", []) + @patch("sunbeam.steps.openstack.load_answers") + @patch("sunbeam.steps.openstack.QuestionBank") + def test_manifest_without_endpoints_does_not_prompt( + self, mock_question_bank, mock_load_answers + ): + """Manifest provided but core.config.endpoints, the user should not be asked.""" + mock_load_answers.return_value = {} + mock_bank_instance = mock_question_bank.return_value + + manifest = Mock() + manifest.core.config.endpoints = None + + step = self._make_step(manifest=manifest, accept_defaults=False) + step.prompt(console=None) + + mock_bank_instance.configure.ask.assert_not_called() + assert step.variables["configure"] is False + + @patch("sunbeam.steps.openstack.INGRESS_ENDPOINT_TYPES", []) + @patch("sunbeam.steps.openstack.load_answers") + @patch("sunbeam.steps.openstack.QuestionBank") + def test_manifest_with_endpoints_does_not_prompt_uses_value( + self, mock_question_bank, mock_load_answers + ): + """Manifest provided with core.config.endpoints set, the user should not be asked""" + mock_load_answers.return_value = {} + mock_bank_instance = mock_question_bank.return_value + + manifest = Mock() + manifest.core.config.endpoints.model_dump.return_value = { + "configure": True, + } + + step = self._make_step(manifest=manifest, accept_defaults=False) + step.prompt(console=None) + + mock_bank_instance.configure.ask.assert_not_called() + assert step.variables["configure"] is True + + @patch("sunbeam.steps.openstack.load_answers") + @patch("sunbeam.steps.openstack.QuestionBank") + def test_accept_defaults_does_not_prompt_even_without_manifest( + self, mock_question_bank, mock_load_answers + ): + """--accept-defaults set: should not prompt, regardless of the manifest.""" + mock_load_answers.return_value = {} + mock_bank_instance = mock_question_bank.return_value + + step = self._make_step(manifest=None, accept_defaults=True) + step.prompt(console=None) + + mock_bank_instance.ask.assert_not_called() + assert step.variables["configure"] is False \ No newline at end of file From 2e8e133c4ca51b6fd0f4f9a7c0cddd805375bbaf Mon Sep 17 00:00:00 2001 From: Raphaela Silva Date: Wed, 26 Aug 2026 16:56:20 -0300 Subject: [PATCH 2/5] fix(sunbeam-python): skip endpoint prompt when manifest omits optional endpoints field --- sunbeam-python/tests/unit/sunbeam/steps/test_openstack.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sunbeam-python/tests/unit/sunbeam/steps/test_openstack.py b/sunbeam-python/tests/unit/sunbeam/steps/test_openstack.py index 7291c3beb..023c9dd3d 100644 --- a/sunbeam-python/tests/unit/sunbeam/steps/test_openstack.py +++ b/sunbeam-python/tests/unit/sunbeam/steps/test_openstack.py @@ -2053,4 +2053,4 @@ def test_accept_defaults_does_not_prompt_even_without_manifest( step.prompt(console=None) mock_bank_instance.ask.assert_not_called() - assert step.variables["configure"] is False \ No newline at end of file + assert step.variables["configure"] is False From ec8dd17d1f4fa99cfb846547cdb2729e00800609 Mon Sep 17 00:00:00 2001 From: Raphaela Silva Date: Wed, 26 Aug 2026 17:22:47 -0300 Subject: [PATCH 3/5] fix: sort imports and shorten docstring line for pep8 --- sunbeam-python/tests/unit/sunbeam/steps/test_openstack.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sunbeam-python/tests/unit/sunbeam/steps/test_openstack.py b/sunbeam-python/tests/unit/sunbeam/steps/test_openstack.py index 023c9dd3d..d1ec023b3 100644 --- a/sunbeam-python/tests/unit/sunbeam/steps/test_openstack.py +++ b/sunbeam-python/tests/unit/sunbeam/steps/test_openstack.py @@ -34,11 +34,11 @@ OPENSTACK_MODEL_CONFIG_KEY, RABBITMQ_STORAGE_KEY, DeployControlPlaneStep, + EndpointsConfigurationStep, OpenStackPatchLoadBalancerServicesIPPoolStep, OpenStackPatchLoadBalancerServicesIPStep, ReapplyOpenStackTerraformPlanStep, UpdateOpenStackModelConfigStep, - EndpointsConfigurationStep, compute_ha_scale, compute_ingress_scale, compute_os_api_scale, @@ -1989,7 +1989,7 @@ def _make_step(self, manifest=None, accept_defaults=False, client=None): def test_no_manifest_no_accept_defaults_prompts_interactively( self, mock_question_bank, mock_load_answers ): - """With no manifest and no --accept-defaults, the user should be asked.""" + """With no manifest and no --accept-defaults, should prompt.""" mock_load_answers.return_value = {} mock_bank_instance = mock_question_bank.return_value mock_bank_instance.configure.ask.return_value = True @@ -2006,7 +2006,7 @@ def test_no_manifest_no_accept_defaults_prompts_interactively( def test_manifest_without_endpoints_does_not_prompt( self, mock_question_bank, mock_load_answers ): - """Manifest provided but core.config.endpoints, the user should not be asked.""" + """Manifest provided and no core.config.endpoints, should not prompt.""" mock_load_answers.return_value = {} mock_bank_instance = mock_question_bank.return_value @@ -2025,7 +2025,7 @@ def test_manifest_without_endpoints_does_not_prompt( def test_manifest_with_endpoints_does_not_prompt_uses_value( self, mock_question_bank, mock_load_answers ): - """Manifest provided with core.config.endpoints set, the user should not be asked""" + """Manifest provided with core.config.endpoints, should not prompt.""" mock_load_answers.return_value = {} mock_bank_instance = mock_question_bank.return_value From 6892017a8a042a4adda4c9c99c66200a47764293 Mon Sep 17 00:00:00 2001 From: Raphaela Silva Date: Fri, 4 Sep 2026 18:10:47 -0300 Subject: [PATCH 4/5] fix on test test_accept_defaults_does_not_prompt_even_without_manifest --- sunbeam-python/tests/unit/sunbeam/steps/test_openstack.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sunbeam-python/tests/unit/sunbeam/steps/test_openstack.py b/sunbeam-python/tests/unit/sunbeam/steps/test_openstack.py index d1ec023b3..b334aa1eb 100644 --- a/sunbeam-python/tests/unit/sunbeam/steps/test_openstack.py +++ b/sunbeam-python/tests/unit/sunbeam/steps/test_openstack.py @@ -2052,5 +2052,5 @@ def test_accept_defaults_does_not_prompt_even_without_manifest( step = self._make_step(manifest=None, accept_defaults=True) step.prompt(console=None) - mock_bank_instance.ask.assert_not_called() + mock_bank_instance.configure.ask.assert_not_called() assert step.variables["configure"] is False From d1f6a398f2ab207d3d531c92bc9e2bedd12feb75 Mon Sep 17 00:00:00 2001 From: Raphaela Silva Date: Mon, 7 Sep 2026 12:42:40 -0300 Subject: [PATCH 5/5] CI re-run Signed-off-by: Raphaela Silva