From 873d17c4837e3768110494b709745d2ff1af4853 Mon Sep 17 00:00:00 2001 From: Dougal Matthews Date: Tue, 20 Sep 2016 17:09:48 +0100 Subject: [PATCH] Ensure that the default plan was created successfully In change Id8001fee677fe321b42892264e3c55afb6790e1c we wait for the workflow to finish, but don't verify that it didn't error as there is an issue with the default plan creation. There is a fix for this which this patch depends on. This change also expands on the error messages so users can more easily debug the problem. Closes-Bug: #1622683 Depends-On: Ic494ed0874dd79e148ef9c7093bdcf32bed4d6ae Change-Id: Iaaf528372b57c19480c47fe22213b27b8ca871a7 --- instack_undercloud/tests/test_undercloud.py | 9 +++------ instack_undercloud/undercloud.py | 11 ++++++++--- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/instack_undercloud/tests/test_undercloud.py b/instack_undercloud/tests/test_undercloud.py index 23390871b..a18f046d4 100644 --- a/instack_undercloud/tests/test_undercloud.py +++ b/instack_undercloud/tests/test_undercloud.py @@ -572,12 +572,9 @@ class TestPostConfig(base.BaseTestCase): mock_mistral.environments.list.return_value = [] mock_mistral.executions.get.return_value = mock.Mock(state="ERROR") - # TODO(dmatthews): Switch to this check after this lands: - # https://review.openstack.org/#/c/371347/ - # self.assertRaises( - # RuntimeError, - # undercloud._create_default_plan, mock_mistral) - undercloud._create_default_plan(mock_mistral) + self.assertRaises( + RuntimeError, + undercloud._create_default_plan, mock_mistral) @mock.patch('instack_undercloud.undercloud._run_command') def test_copy_stackrc(self, mock_run): diff --git a/instack_undercloud/undercloud.py b/instack_undercloud/undercloud.py index 544899c21..42d8c6084 100644 --- a/instack_undercloud/undercloud.py +++ b/instack_undercloud/undercloud.py @@ -1124,13 +1124,18 @@ def _create_default_plan(mistral, timeout=60): if exe.state == "SUCCESS": return else: - LOG.warning("Failed to create the default Deployment Plan.") - return + raise RuntimeError( + "Failed to create the default Deployment Plan. Please check " + "the create_default_deployment_plan execution in Mistral with " + "`openstack workflow execution list`.") else: exe = mistral.executions.get(execution.id) LOG.error("Timed out waiting for execution %s to finish. State: %s", exe.id, exe.state) - raise RuntimeError("Timed out creating the default Deployment Plan.") + raise RuntimeError( + "Timed out creating the default Deployment Plan. Please check " + "the create_default_deployment_plan execution in Mistral with " + "`openstack workflow execution list`.") def _prepare_ssh_environment(mistral):