From 2fd01df5dd4d52681125762f0df6f0231e6b2e7f Mon Sep 17 00:00:00 2001 From: Alex Schultz Date: Wed, 11 Jul 2018 15:15:29 -0600 Subject: [PATCH] Update output messaging for standalone/undercloud With the exposing of the tripleo deploy command, the installation and success messaging should be different in the containerized undercloud case vs the standalone. This change adds different messaging to be added at the end of the undercloud installation and reduces what we print when standalone is used. Change-Id: I99ce8abde838f16cabefe641b107e55b508c2cf9 Related-Blueprint: all-in-one --- tripleoclient/v1/tripleo_deploy.py | 33 ++++++++------- tripleoclient/v1/undercloud.py | 68 +++++++++++++++++++++++++++++- 2 files changed, 84 insertions(+), 17 deletions(-) diff --git a/tripleoclient/v1/tripleo_deploy.py b/tripleoclient/v1/tripleo_deploy.py index 4d80424ce..0bd6b617e 100644 --- a/tripleoclient/v1/tripleo_deploy.py +++ b/tripleoclient/v1/tripleo_deploy.py @@ -47,26 +47,25 @@ from tripleo_common.inventory import TripleoInventory from tripleo_common.utils import config DEPLOY_FAILURE_MESSAGE = """ -########################################################## -containerized undercloud deployment failed. +!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +Deployment Failed! ERROR: Heat log files: {0} -See the previous output for details about what went wrong. - -########################################################## +!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! """ DEPLOY_COMPLETION_MESSAGE = """ ######################################################## -containerized undercloud deployment complete. -Useful files: +Deployment successfull! -Password file is at {0} -The stackrc file is at {1} +######################################################## +""" +OUTPUT_ONLY_COMPLETION_MESSAGE = """ +######################################################## -Use these files to interact with OpenStack services, and -ensure they are secured. +Deployment information successfully generated! ######################################################## """ @@ -989,11 +988,15 @@ class Deploy(command.Command): raise exceptions.DeploymentError('Deployment failed.') else: # We only get here if no errors - self.log.warning(DEPLOY_COMPLETION_MESSAGE.format( - '~/undercloud-passwords.conf', - '~/stackrc' - )) + if parsed_args.output_only: + success_messaging = OUTPUT_ONLY_COMPLETION_MESSAGE + else: + success_messaging = DEPLOY_COMPLETION_MESSAGE.format( + '~/undercloud-passwords.conf', + '~/stackrc' + ) + self.log.warning(success_messaging) if (self.stack_update_mark and (not parsed_args.output_only or parsed_args.force_stack_update)): diff --git a/tripleoclient/v1/undercloud.py b/tripleoclient/v1/undercloud.py index 2e8cb41dc..1cbdf2438 100644 --- a/tripleoclient/v1/undercloud.py +++ b/tripleoclient/v1/undercloud.py @@ -25,9 +25,51 @@ from oslo_config import cfg from tripleoclient import command from tripleoclient import constants +from tripleoclient import exceptions from tripleoclient import utils from tripleoclient.v1 import undercloud_config +UNDERCLOUD_FAILURE_MESSAGE = """ +!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +An error has occured while deploying the Undercloud. + +See the previous output for details about what went wrong. + +!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +""" + +UNDERCLOUD_COMPLETION_MESSAGE = """ +########################################################## + +The Undercloud has been successfully installed. + +Useful files: + +Password file is at {0} +The stackrc file is at {1} + +Use these files to interact with OpenStack services, and +ensure they are secured. + +########################################################## +""" +UNDERCLOUD_UPGRADE_COMPLETION_MESSAGE = """ +########################################################## + +The Undercloud has been successfully upgraded. + +Useful files: + +Password file is at {0} +The stackrc file is at {1} + +Use these files to interact with OpenStack services, and +ensure they are secured. + +########################################################## +""" + class InstallUndercloud(command.Command): """Install and setup the undercloud""" @@ -110,7 +152,18 @@ class InstallUndercloud(command.Command): self.log.warning("Running: %s" % ' '.join(cmd)) if not parsed_args.dry_run: - subprocess.check_call(cmd) + try: + subprocess.check_call(cmd) + self.log.warning(UNDERCLOUD_COMPLETION_MESSAGE.format( + '~/undercloud-passwords.conf', + '~/stackrc' + )) + except Exception as e: + self.log.error(UNDERCLOUD_FAILURE_MESSAGE.format( + self.heat_launch.install_tmp + )) + self.log.error(e) + raise exceptions.DeploymentError(e) class UpgradeUndercloud(InstallUndercloud): @@ -156,4 +209,15 @@ class UpgradeUndercloud(InstallUndercloud): verbose_level=self.app_args.verbose_level, force_stack_update=parsed_args.force_stack_update) self.log.warning("Running: %s" % ' '.join(cmd)) - subprocess.check_call(cmd) + try: + subprocess.check_call(cmd) + self.log.warning(UNDERCLOUD_UPGRADE_COMPLETION_MESSAGE.format( + '~/undercloud-passwords.conf', + '~/stackrc' + )) + except Exception as e: + self.log.error(UNDERCLOUD_FAILURE_MESSAGE.format( + self.heat_launch.install_tmp + )) + self.log.error(e) + raise exceptions.DeploymentError(e)