def run(req, logger): install_spec_option_no = select_configuration(req.installer_file_layout, req.config_choices) # need to manually record the deployment home in the choice history, as it is used # to validate other inputs req.config_choices.choice_history["Install directory"] = req.deployment_home # create the install spec target_machine = get_target_machine_resource(req.deployment_home, req.installer_file_layout.get_log_directory()) hosts = create_install_spec(target_machine, req.installer_file_layout.get_install_spec_template_file(install_spec_option_no), req.installer_file_layout.get_install_spec_file(install_spec_option_no), req.installer_file_layout, logger) # here is were we handle any additional configuration inputs password_list = set_install_spec_properties(req.installer_file_layout, install_spec_option_no, req.config_choices, target_machine, logger) # save the history file to user location, if provided if req.options.history_file: req.config_choices.save_history_file(os.path.abspath(os.path.expanduser(req.options.history_file))) # if fresh install, always save choices to config directory, for use in future upgradesa req.config_choices.save_history_file(os.path.join(req.installer_file_layout.get_config_choices_file(req.deployment_home))) # run the configuration engine preprocess_and_run_config_engine(req.installer_file_layout, req.installer_file_layout.get_install_spec_file(install_spec_option_no)) if not req.upgrade_from: # this is a fresh install for host in hosts: if host["id"] != "master-host": setup_slave_host(host, req.deployment_home, pw_file, pw_salt_file) install_engine_args = \ cmdline_script_utils.extract_standard_options(req.options) logger.debug("Invoking install engine with arguments %s" % install_engine_args) return install_engine.main(install_engine_args, installer_supplied_pw_key_list=password_list, file_layout=req.installer_file_layout) else: # TODO PW: Fix this to use new passwords return upgrade_engine.upgrade(req.upgrade_from, req.installer_file_layout, req.deployment_home, req.options, atomic_upgrade=(not req.options.no_rollback_on_failed_upgrades))
def run(self, logger): if self.options.additive_install: # For an additive install, we rename the original install spec # and then create a new one that merges the spec with the already # installed resources. orig_spec_file = self.input_spec_file self.input_spec_file = orig_spec_file.replace('.json', '.merged.json') \ if orig_spec_file.endswith('.json') \ else orig_spec_file + '.merged' with open(orig_spec_file, 'rb') as f: install_spec_resources = json.load(f) irf = self.efl.get_installed_resources_file(self.deployment_home) with open(irf, 'rb') as f: installed_resources = json.load(f) merged_spec = merge_new_install_spec_into_existing(install_spec_resources, installed_resources, logger) with open(self.input_spec_file, 'wb') as f: json.dump(merged_spec, f) # Rename the old installed resource file so we don't lose it if # things fail. os.rename(irf, irf + '.prev') try: hosts = create_install_spec(self.tr, self.input_spec_file, self.efl.get_install_spec_file(), self.efl, logger) validate_install_spec(self.efl.get_install_spec_file()) config_engine.preprocess_and_run_config_engine(self.efl, self.efl.get_install_spec_file()) except: if self.options.additive_install: logger.debug("Additive install: Problem in preparing new install spec, reverting old install spec file") os.rename(irf + '.prev', irf) raise try: ie_args = cmdline_script_utils.extract_standard_options(self.options) return install_engine.main(ie_args, file_layout=self.efl, installer_supplied_pw_key_list=None) except: if self.options.additive_install and not os.path.exists(irf): logger.debug("Additive install: Problem in new install, reverting old install spec file") os.rename(irf + '.prev', irf) raise