diff --git a/packstack/installer/output_messages.py b/packstack/installer/output_messages.py index c60616e0b..32f948c58 100644 --- a/packstack/installer/output_messages.py +++ b/packstack/installer/output_messages.py @@ -26,6 +26,7 @@ INFO_USE_PARAMS="Proceed with the configuration listed above" INFO_DONE="DONE" INFO_ERROR="ERROR" INFO_LOG_FILE_PATH="The installation log file is available at: %s" +INFO_MANIFEST_PATH="The generated manifests are available at: %s" INFO_ADDTIONAL_MSG="Additional information:" INFO_ADDTIONAL_MSG_BULLET=" * %s" INFO_CONF_PARAMS_PASSWD_CONFIRM_PROMPT="Confirm password" diff --git a/packstack/installer/run_setup.py b/packstack/installer/run_setup.py index f479313c1..c4829a6d9 100644 --- a/packstack/installer/run_setup.py +++ b/packstack/installer/run_setup.py @@ -534,6 +534,8 @@ def _addFinalInfoMsg(): successfull install of rhemv """ controller.MESSAGES.append(output_messages.INFO_LOG_FILE_PATH%(logFile)) + controller.MESSAGES.append( + output_messages.INFO_MANIFEST_PATH%(basedefs.PUPPET_MANIFEST_DIR)) def _summaryParamsToLog(): @@ -710,8 +712,10 @@ def initCmdLineParser(): "--novacompute-privif=lo --novanetwork-privif=lo --os-swift-install=y --nagios-install=y " ", this option can be used to install an all in one OpenStack on this host") + parser.add_option("-t", "--timeout", default=300, help="The timeout for puppet Exec calls") parser.add_option("-o", "--options", action="store_true", dest="options", help="Print details on options available in answer file(rst format)") parser.add_option("-d", "--debug", action="store_true", default=False, help="Enable debug in logging") + parser.add_option("-y", "--dry-run", action="store_true", default=False, help="Don't execute, just generate manifests") # For each group, create a group option for group in controller.getAllGroups(): @@ -799,10 +803,7 @@ def countCmdLineFlags(options, flag): counter = 0 # make sure only flag was supplied for key, value in options.__dict__.items(): - if key == flag: - next - # Do not count --debug - elif key == 'debug': + if key in (flag, 'debug', 'timeout', 'dry_run'): next # If anything but flag was called, increment elif value: @@ -873,6 +874,9 @@ def main(): runConfiguration = True confFile = None + controller.CONF['DEFAULT_EXEC_TIMEOUT'] = options.timeout + controller.CONF['DRY_RUN'] = options.dry_run + # If --gen-answer-file was supplied, do not run main if options.gen_answer_file: # Make sure only --gen-answer-file was supplied diff --git a/packstack/modules/ospluginutils.py b/packstack/modules/ospluginutils.py index d4fc0e004..d69581ea0 100644 --- a/packstack/modules/ospluginutils.py +++ b/packstack/modules/ospluginutils.py @@ -39,6 +39,7 @@ class ManifestFiles(object): def __init__(self): self.filelist = [] self.data = {} + self.global_data = None # continuous manifest file that have the same marker can be # installed in parallel, if on different servers @@ -58,12 +59,15 @@ class ManifestFiles(object): Write out the manifest data to disk, this should only be called once write before the puppet manifests are copied to the various servers """ + if not self.global_data: + with open(os.path.join(PUPPET_TEMPLATE_DIR, "global.pp")) as gfp: + self.global_data = gfp.read() % controller.CONF os.mkdir(basedefs.PUPPET_MANIFEST_DIR, 0700) for fname, data in self.data.items(): path = os.path.join(basedefs.PUPPET_MANIFEST_DIR, fname) fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_EXCL, 0600) with os.fdopen(fd, 'w') as fp: - fp.write(data) + fp.write(self.global_data + data) manifestfiles = ManifestFiles() diff --git a/packstack/plugins/puppet_950.py b/packstack/plugins/puppet_950.py index b69ab154a..16bb97757 100644 --- a/packstack/plugins/puppet_950.py +++ b/packstack/plugins/puppet_950.py @@ -176,6 +176,8 @@ def waitforpuppet(currently_running): def applyPuppetManifest(config): print + if config.get("DRY_RUN"): + return currently_running = [] lastmarker = None for manifest, marker in manifestfiles.getFiles(): diff --git a/packstack/puppet/templates/global.pp b/packstack/puppet/templates/global.pp new file mode 100644 index 000000000..c2aaad10c --- /dev/null +++ b/packstack/puppet/templates/global.pp @@ -0,0 +1 @@ +Exec { timeout => %(DEFAULT_EXEC_TIMEOUT)s }