Print the used logfile also at the beginning

Change-Id: Icb3a44c36b50b31b3436c3e693f6d88879b70080
This commit is contained in:
Christian Berendt
2014-12-09 21:37:39 +01:00
parent 61140c6d16
commit 8acb7cc11d
2 changed files with 17 additions and 15 deletions

View File

@@ -41,6 +41,7 @@ finally:
_tmpdirprefix = datetime.datetime.now().strftime('%Y%m%d-%H%M%S-') _tmpdirprefix = datetime.datetime.now().strftime('%Y%m%d-%H%M%S-')
VAR_DIR = tempfile.mkdtemp(prefix=_tmpdirprefix, dir=PACKSTACK_VAR_DIR) VAR_DIR = tempfile.mkdtemp(prefix=_tmpdirprefix, dir=PACKSTACK_VAR_DIR)
DIR_LOG = VAR_DIR DIR_LOG = VAR_DIR
FILE_LOG = 'openstack-setup.log'
PUPPET_MANIFEST_RELATIVE = "manifests" PUPPET_MANIFEST_RELATIVE = "manifests"
PUPPET_MANIFEST_DIR = os.path.join(VAR_DIR, PUPPET_MANIFEST_RELATIVE) PUPPET_MANIFEST_DIR = os.path.join(VAR_DIR, PUPPET_MANIFEST_RELATIVE)
HIERADATA_FILE_RELATIVE = "hieradata" HIERADATA_FILE_RELATIVE = "hieradata"

View File

@@ -33,11 +33,8 @@ masked_value_set = set()
tmpfiles = [] tmpfiles = []
def initLogging (debug): def initLogging (debug):
global logFile
try: try:
logFilename = "openstack-setup.log" logFile = os.path.join(basedefs.DIR_LOG, basedefs.FILE_LOG)
logFile = os.path.join(basedefs.DIR_LOG, logFilename)
# Create the log file with specific permissions, puppet has a habbit of putting # Create the log file with specific permissions, puppet has a habbit of putting
# passwords in logs # passwords in logs
@@ -61,6 +58,8 @@ def initLogging (debug):
logging.error(traceback.format_exc()) logging.error(traceback.format_exc())
raise Exception(output_messages.ERR_EXP_FAILED_INIT_LOGGER) raise Exception(output_messages.ERR_EXP_FAILED_INIT_LOGGER)
return logFile
def _getInputFromUser(param): def _getInputFromUser(param):
""" """
this private func reads the data from the user this private func reads the data from the user
@@ -568,7 +567,7 @@ def _printAdditionalMessages():
for msg in controller.MESSAGES: for msg in controller.MESSAGES:
print output_messages.INFO_ADDTIONAL_MSG_BULLET%(msg) print output_messages.INFO_ADDTIONAL_MSG_BULLET%(msg)
def _addFinalInfoMsg(): def _addFinalInfoMsg(logFile):
""" """
add info msg to the user finalizing the add info msg to the user finalizing the
successfull install of rhemv successfull install of rhemv
@@ -591,8 +590,10 @@ def _summaryParamsToLog():
def runSequences(): def runSequences():
controller.runAllSequences() controller.runAllSequences()
def _main(options, configFile=None): def _main(options, configFile=None, logFile=None):
print output_messages.INFO_HEADER print output_messages.INFO_HEADER
print("")
print(output_messages.INFO_LOG_FILE_PATH % logFile)
# Get parameters # Get parameters
_handleParams(configFile) _handleParams(configFile)
@@ -622,7 +623,7 @@ def _main(options, configFile=None):
#_lockRpmVersion() #_lockRpmVersion()
# Print info # Print info
_addFinalInfoMsg() _addFinalInfoMsg(logFile)
print output_messages.INFO_INSTALL_SUCCESS print output_messages.INFO_INSTALL_SUCCESS
@@ -693,7 +694,7 @@ def generateAnswerFile(outputFile, overrides={}):
'conf_name': param.CONF_NAME} 'conf_name': param.CONF_NAME}
ans_file.write(fmt % args) ans_file.write(fmt % args)
def single_step_aio_install(options): def single_step_aio_install(options, logFile):
""" Installs an All in One host on this host""" """ Installs an All in One host on this host"""
options.install_hosts = utils.get_localhost_ip() options.install_hosts = utils.get_localhost_ip()
@@ -713,9 +714,9 @@ def single_step_aio_install(options):
not options.provision_all_in_one_ovs_bridge): not options.provision_all_in_one_ovs_bridge):
options.provision_all_in_one_ovs_bridge = "y" options.provision_all_in_one_ovs_bridge = "y"
single_step_install(options) single_step_install(options, logFile)
def single_step_install(options): def single_step_install(options, logFile):
answerfilepath = _gettmpanswerfilepath() answerfilepath = _gettmpanswerfilepath()
if not answerfilepath: if not answerfilepath:
_printAdditionalMessages() _printAdditionalMessages()
@@ -743,7 +744,7 @@ def single_step_install(options):
overrides[key] = value overrides[key] = value
generateAnswerFile(answerfilepath, overrides) generateAnswerFile(answerfilepath, overrides)
_main(options,answerfilepath) _main(options,answerfilepath, logFile)
def initCmdLineParser(): def initCmdLineParser():
""" """
@@ -907,7 +908,7 @@ def main():
raise SystemExit raise SystemExit
# Initialize logging # Initialize logging
initLogging (options.debug) logFile = initLogging (options.debug)
# Parse parameters # Parse parameters
runConfiguration = True runConfiguration = True
@@ -938,10 +939,10 @@ def main():
msg = ('Please use either --allinone or --answer-file, ' msg = ('Please use either --allinone or --answer-file, '
'but not both.') 'but not both.')
raise FlagValidationError(msg) raise FlagValidationError(msg)
single_step_aio_install(options) single_step_aio_install(options, logFile)
# Are we installing in a single step # Are we installing in a single step
elif options.install_hosts: elif options.install_hosts:
single_step_install(options) single_step_install(options, logFile)
# Otherwise, run main() # Otherwise, run main()
else: else:
# Make sure only --answer-file was supplied # Make sure only --answer-file was supplied
@@ -958,7 +959,7 @@ def main():
raise Exception(output_messages.ERR_NO_ANSWER_FILE % confFile) raise Exception(output_messages.ERR_NO_ANSWER_FILE % confFile)
else: else:
_set_command_line_values(options) _set_command_line_values(options)
_main(options,confFile) _main(options, confFile, logFile)
except FlagValidationError as ex: except FlagValidationError as ex:
optParser.error(str(ex)) optParser.error(str(ex))