def take_action(self, parsed_args): # Fetch configuration used to add logging to a file utils.load_config(self.osloconfig, constants.UNDERCLOUD_CONF_PATH) utils.configure_logging(self.log, self.app_args.verbose_level, self.osloconfig['undercloud_log_file']) self.log.debug("take action(%s)" % parsed_args) utils.ensure_run_as_normal_user() self._update_extra_packages(constants.UNDERCLOUD_EXTRA_PACKAGES, parsed_args.dry_run) cmd = undercloud_config.\ prepare_undercloud_deploy( upgrade=True, yes=parsed_args.yes, no_validations=parsed_args. no_validations, verbose_level=self.app_args.verbose_level, force_stack_update=parsed_args.force_stack_update) self.log.warning("Running: %s" % ' '.join(cmd)) if not parsed_args.dry_run: try: subprocess.check_call(cmd) self.log.warning( UNDERCLOUD_UPGRADE_COMPLETION_MESSAGE.format( os.path.join(constants.UNDERCLOUD_OUTPUT_DIR, 'undercloud-passwords.conf'), '~/stackrc')) except Exception as e: self.log.error(UNDERCLOUD_FAILURE_MESSAGE) self.log.error(e) raise exceptions.DeploymentError(e)
def take_action(self, parsed_args): # Fetch configuration used to add logging to a file utils.load_config(self.osloconfig, constants.UNDERCLOUD_CONF_PATH) utils.configure_logging(self.log, self.app_args.verbose_level, self.osloconfig['undercloud_log_file']) self.log.debug("take action(%s)" % parsed_args) utils.ensure_run_as_normal_user() if parsed_args.use_heat: cmd = undercloud_config.\ prepare_undercloud_deploy( upgrade=True, yes=parsed_args.yes, no_validations=parsed_args. no_validations, 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) else: self.log.warning( _('Non-containerized undercloud deployment is ' 'deprecated in Rocky cycle.')) subprocess.check_call( ['sudo', 'yum', 'update', '-y', 'instack-undercloud']) subprocess.check_call("instack-pre-upgrade-undercloud") subprocess.check_call("instack-upgrade-undercloud") # restart nova-api # https://bugzilla.redhat.com/show_bug.cgi?id=1315467 subprocess.check_call( ['sudo', 'systemctl', 'restart', 'openstack-nova-api'])
def take_action(self, parsed_args): # Fetch configuration used to add logging to a file utils.load_config(self.osloconfig, constants.UNDERCLOUD_CONF_PATH) utils.configure_logging(self.log, self.app_args.verbose_level, self.osloconfig['undercloud_log_file']) self.log.debug("take_action(%s)" % parsed_args) utils.ensure_run_as_normal_user() if parsed_args.use_heat: no_validations = parsed_args.dry_run or parsed_args.no_validations cmd = undercloud_config.\ prepare_undercloud_deploy( no_validations=no_validations, verbose_level=self.app_args.verbose_level, force_stack_update=parsed_args.force_stack_update, dry_run=parsed_args.dry_run) else: self.log.warning( _('Non-containerized undercloud deployment is ' 'deprecated in Rocky cycle.')) cmd = ["instack-install-undercloud"] self.log.warning("Running: %s" % ' '.join(cmd)) if not parsed_args.dry_run: subprocess.check_call(cmd)
def take_action(self, parsed_args): # Fetch configuration used to add logging to a file utils.load_config(self.osloconfig, constants.MINION_CONF_PATH) utils.configure_logging(self.log, self.app_args.verbose_level, self.osloconfig['minion_log_file']) self.log.debug("take action(%s)" % parsed_args) utils.ensure_run_as_normal_user() cmd = minion_config.\ prepare_minion_deploy( upgrade=True, yes=parsed_args.yes, no_validations=parsed_args. no_validations, verbose_level=self.app_args.verbose_level, force_stack_update=parsed_args.force_stack_update) self.log.warning("Running: %s" % ' '.join(cmd)) if not parsed_args.dry_run: try: subprocess.check_call(cmd) self.log.warning(MINION_UPGRADE_COMPLETION_MESSAGE) except Exception as e: self.log.error(MINION_FAILURE_MESSAGE) self.log.error(e) raise exceptions.DeploymentError(e)
def take_action(self, parsed_args): # Fetch configuration used to add logging to a file utils.load_config(self.osloconfig, constants.UNDERCLOUD_CONF_PATH) utils.configure_logging(self.log, self.app_args.verbose_level, self.osloconfig['undercloud_log_file']) self.log.debug("take_action(%s)" % parsed_args) utils.ensure_run_as_normal_user() no_validations = parsed_args.dry_run or parsed_args.no_validations inflight = not parsed_args.dry_run and parsed_args.inflight cmd = undercloud_config.prepare_undercloud_deploy( no_validations=no_validations, verbose_level=self.app_args.verbose_level, force_stack_update=parsed_args.force_stack_update, dry_run=parsed_args.dry_run, inflight=inflight) self.log.warning("Running: %s" % ' '.join(cmd)) if not parsed_args.dry_run: 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) self.log.error(e) raise exceptions.DeploymentError(e)
def take_action(self, parsed_args): self.log.debug("take action(%s)" % parsed_args) utils.ensure_run_as_normal_user() subprocess.check_call(['sudo', 'yum', 'update', '-y']) subprocess.check_call("instack-install-undercloud")
def take_action(self, parsed_args): # Fetch configuration used to add logging to a file utils.load_config(self.osloconfig, constants.UNDERCLOUD_CONF_PATH) utils.configure_logging(self.log, self.app_args.verbose_level, self.osloconfig['undercloud_log_file']) self.log.debug("take action(%s)" % parsed_args) if (not parsed_args.yes and not utils.prompt_user_for_confirmation( constants.UPGRADE_PROMPT, self.log)): raise exceptions.UndercloudUpgradeNotConfirmed( constants.UPGRADE_NO) utils.ensure_run_as_normal_user() if not parsed_args.skip_package_updates: if ('python3' in sys.executable): pyver = '3' else: pyver = '2' client_pkgs = [ "python{}-tripleoclient".format(pyver), ] pkgs = client_pkgs + constants.UNDERCLOUD_EXTRA_PACKAGES self._update_extra_packages(pkgs, parsed_args.dry_run) self._invoke_self(parsed_args) else: self._run_upgrade(parsed_args)
def take_action(self, parsed_args): self.log.debug("take_action(%s)" % parsed_args) utils.ensure_run_as_normal_user() subprocess.check_call("instack-install-undercloud") return
def take_action(self, parsed_args): self.log.debug("take action(%s)" % parsed_args) utils.ensure_run_as_normal_user() subprocess.check_call(['sudo', 'yum', 'update', '-y']) subprocess.check_call("instack-install-undercloud") # restart nova-api https://bugzilla.redhat.com/show_bug.cgi?id=1315467 subprocess.check_call(['sudo', 'systemctl', 'restart', 'openstack-nova-api'])
def take_action(self, parsed_args): self.log.debug("take action(%s)" % parsed_args) utils.ensure_run_as_normal_user() subprocess.check_call(['sudo', 'yum', 'update', '-y']) subprocess.check_call("instack-install-undercloud") # restart nova-api https://bugzilla.redhat.com/show_bug.cgi?id=1315467 subprocess.check_call( ['sudo', 'systemctl', 'restart', 'openstack-nova-api'])
def take_action(self, parsed_args): self.log.debug("take_action(%s)" % parsed_args) utils.ensure_run_as_normal_user() if parsed_args.use_heat: cmd = undercloud_config.\ prepare_undercloud_deploy(no_validations=parsed_args. no_validations) print("Running: %s" % ' '.join(cmd)) subprocess.check_call(cmd) else: subprocess.check_call("instack-install-undercloud")
def take_action(self, parsed_args): # Fetch configuration used to add logging to a file utils.load_config(self.osloconfig, constants.UNDERCLOUD_CONF_PATH) utils.configure_logging(self.log, self.app_args.verbose_level, self.osloconfig['undercloud_log_file']) self.log.debug("take action(%s)" % parsed_args) utils.ensure_run_as_normal_user() if parsed_args.use_heat is not None: self.log.warning('--use-heat is deprecated in Rocky') if parsed_args.use_heat is not None and \ parsed_args.use_heat.lower() == "false": self.log.warning( _('Non-containerized undercloud deployment is ' 'deprecated in Rocky cycle.')) subprocess.check_call( ['sudo', 'yum', 'update', '-y', 'instack-undercloud']) subprocess.check_call("instack-pre-upgrade-undercloud") subprocess.check_call("instack-upgrade-undercloud") # restart nova-api # https://bugzilla.redhat.com/show_bug.cgi?id=1315467 subprocess.check_call( ['sudo', 'systemctl', 'restart', 'openstack-nova-api']) else: cmd = undercloud_config.\ prepare_undercloud_deploy( upgrade=True, yes=parsed_args.yes, no_validations=parsed_args. no_validations, verbose_level=self.app_args.verbose_level, force_stack_update=parsed_args.force_stack_update) self.log.warning("Running: %s" % ' '.join(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)
def take_action(self, parsed_args): self.log.debug("take action(%s)" % parsed_args) utils.ensure_run_as_normal_user() if parsed_args.use_heat: cmd = undercloud_config.\ prepare_undercloud_deploy(upgrade=True, no_validations=parsed_args. no_validations) print("Running: %s" % ' '.join(cmd)) subprocess.check_call(cmd) else: subprocess.check_call(['sudo', 'yum', 'update', '-y', 'instack-undercloud']) subprocess.check_call("instack-pre-upgrade-undercloud") subprocess.check_call("instack-upgrade-undercloud") # restart nova-api # https://bugzilla.redhat.com/show_bug.cgi?id=1315467 subprocess.check_call(['sudo', 'systemctl', 'restart', 'openstack-nova-api'])
def take_action(self, parsed_args): # Fetch configuration used to add logging to a file utils.load_config(self.osloconfig, constants.UNDERCLOUD_CONF_PATH) utils.configure_logging(self.log, self.app_args.verbose_level, self.osloconfig['undercloud_log_file']) self.log.debug("take_action(%s)" % parsed_args) utils.ensure_run_as_normal_user() if parsed_args.use_heat is not None: self.log.warning('--use-heat is deprecated in Rocky') if parsed_args.use_heat is not None and \ parsed_args.use_heat.lower() == "false": self.log.warning( _('Non-containerized undercloud deployment is ' 'deprecated in Rocky cycle.')) cmd = ["instack-install-undercloud"] else: no_validations = parsed_args.dry_run or parsed_args.no_validations cmd = undercloud_config.\ prepare_undercloud_deploy( no_validations=no_validations, verbose_level=self.app_args.verbose_level, force_stack_update=parsed_args.force_stack_update, dry_run=parsed_args.dry_run) self.log.warning("Running: %s" % ' '.join(cmd)) if not parsed_args.dry_run: 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)
def take_action(self, parsed_args): # Fetch configuration used to add logging to a file utils.load_config(self.osloconfig, constants.UNDERCLOUD_CONF_PATH) utils.configure_logging(self.log, self.app_args.verbose_level, self.osloconfig['undercloud_log_file']) self.log.debug("take action(%s)" % parsed_args) utils.ensure_run_as_normal_user() if not parsed_args.skip_package_updates: print("executable is {}".format(sys.executable)) if ('python3' in sys.executable): pyver = '3' else: pyver = '2' client_pkgs = [ "python{}-tripleoclient".format(pyver), ] pkgs = client_pkgs + constants.UNDERCLOUD_EXTRA_PACKAGES self._update_extra_packages(pkgs, parsed_args.dry_run) self._invoke_self(parsed_args) else: self._run_upgrade(parsed_args)
def test_ensure_run_as_normal_user(self, os_geteuid_mock): os_geteuid_mock.return_value = 1000 self.assertEqual(utils.ensure_run_as_normal_user(), None)