Merge "Update output messaging for standalone/undercloud"

This commit is contained in:
Zuul 2018-07-14 02:36:22 +00:00 committed by Gerrit Code Review
commit 6070c4be1c
2 changed files with 84 additions and 17 deletions

View File

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

View File

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