From 06fddc5550cd1c62e2c970e8365bfd4da95c1fee Mon Sep 17 00:00:00 2001 From: Alex Schultz Date: Wed, 19 Jun 2019 13:57:04 -0600 Subject: [PATCH] Use wait for stack ready from utils for tripleo deploy The tripleo deploy command was duplicating a function call to the heat stack that we already had a shared function for in utils. Let's use that instead as it now has additional retry logic improvements. Change-Id: I1f22b5b4aa79e5a1f7d340054e08423cd1b1c090 --- tripleoclient/tests/v1/tripleo/test_tripleo_deploy.py | 4 +--- tripleoclient/v1/tripleo_deploy.py | 9 ++++----- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/tripleoclient/tests/v1/tripleo/test_tripleo_deploy.py b/tripleoclient/tests/v1/tripleo/test_tripleo_deploy.py index d81b1a910..4d8a5bfdc 100644 --- a/tripleoclient/tests/v1/tripleo/test_tripleo_deploy.py +++ b/tripleoclient/tests/v1/tripleo/test_tripleo_deploy.py @@ -925,9 +925,7 @@ class TestDeployUndercloud(TestPluginV1): '_configure_puppet') @mock.patch('os.geteuid', return_value=0) @mock.patch('os.environ', return_value='CREATE_COMPLETE') - @mock.patch('tripleoclient.v1.tripleo_deploy.' - 'event_utils.poll_for_events', - return_value=('CREATE_COMPLETE', 0)) + @mock.patch('tripleoclient.utils.wait_for_stack_ready', return_value=True) @mock.patch('tripleoclient.v1.tripleo_deploy.Deploy.' '_set_default_plan') @mock.patch('tripleoclient.utils.ansible_symlink') diff --git a/tripleoclient/v1/tripleo_deploy.py b/tripleoclient/v1/tripleo_deploy.py index 3c17102be..a5b717d9f 100644 --- a/tripleoclient/v1/tripleo_deploy.py +++ b/tripleoclient/v1/tripleo_deploy.py @@ -33,7 +33,6 @@ import yaml from cliff import command from datetime import datetime -from heatclient.common import event_utils from heatclient.common import template_utils from osc_lib.i18n import _ from six.moves import configparser @@ -1210,10 +1209,10 @@ class Deploy(command.Command): parsed_args) # Wait for complete.. - status, msg = event_utils.poll_for_events( - orchestration_client, stack_id, nested_depth=6) - if status != "CREATE_COMPLETE": - message = _("Stack create failed; %s") % msg + status = utils.wait_for_stack_ready(orchestration_client, stack_id, + nested_depth=6) + if not status: + message = _("Stack create failed") self.log.error(message) raise exceptions.DeploymentError(message)