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
This commit is contained in:
Alex Schultz 2019-06-19 13:57:04 -06:00
parent cb42cfe30f
commit 06fddc5550
2 changed files with 5 additions and 8 deletions

View File

@ -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')

View File

@ -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)