diff --git a/tripleoclient/v1/tripleo_deploy.py b/tripleoclient/v1/tripleo_deploy.py index 32f5226e9..a8c80d49f 100644 --- a/tripleoclient/v1/tripleo_deploy.py +++ b/tripleoclient/v1/tripleo_deploy.py @@ -51,26 +51,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! ######################################################## """ @@ -1124,11 +1123,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)