def take_action(self, parsed_args): self.log.debug("take_action({})".format(parsed_args)) clients = self.app.client_manager stack = oooutils.get_stack(clients.orchestration, parsed_args.stack) deployment.get_hosts_and_enable_ssh_admin( self.log, clients, stack, parsed_args.overcloud_ssh_network, parsed_args.overcloud_ssh_user, parsed_args.overcloud_ssh_key)
def take_action(self, parsed_args): self.log.debug("take_action({})".format(parsed_args)) clients = self.app.client_manager stack = oooutils.get_stack(clients.orchestration, parsed_args.stack) deployment.get_hosts_and_enable_ssh_admin( stack, parsed_args.overcloud_ssh_network, parsed_args.overcloud_ssh_user, self.get_key_pair(parsed_args), parsed_args.overcloud_ssh_port_timeout, verbosity=oooutils.playbook_verbosity(self=self))
def take_action(self, parsed_args): self.log.debug("take_action(%s)" % parsed_args) oooutils.ffwd_upgrade_operator_confirm(parsed_args.yes, self.log) clients = self.app.client_manager stack = oooutils.get_stack(clients.orchestration, parsed_args.stack) stack_name = stack.stack_name # ffwd-upgrade "init" run command on overcloud nodes package_update.run_on_nodes( clients, server_name='all', config_name='ffwd-upgrade-prepare', config=constants.FFWD_UPGRADE_PREPARE_SCRIPT, group='script') # In case of update and upgrade we need to force the # update_plan_only. The heat stack update is done by the # packag_update mistral action parsed_args.update_plan_only = True # Add the prepare environment into the args to unset noop etc templates_dir = (parsed_args.templates or constants.TRIPLEO_HEAT_TEMPLATES) if not parsed_args.environment_files: parsed_args.environment_files = [] parsed_args.environment_files = oooutils.prepend_environment( parsed_args.environment_files, templates_dir, constants.FFWD_UPGRADE_PREPARE_ENV) super(FFWDUpgradePrepare, self).take_action(parsed_args) package_update.update(clients, container=stack_name) package_update.get_config(clients, container=stack_name) overcloudrcs = deployment.create_overcloudrc(clients, container=stack_name) oooutils.write_overcloudrc(stack_name, overcloudrcs) # refresh stack info and enable ssh admin for Ansible-via-Mistral stack = oooutils.get_stack(clients.orchestration, parsed_args.stack) deployment.get_hosts_and_enable_ssh_admin( self.log, clients, stack, parsed_args.overcloud_ssh_network, parsed_args.overcloud_ssh_user, parsed_args.overcloud_ssh_key) self.log.info("FFWD Upgrade Prepare on stack {0} complete.".format( parsed_args.stack))
def take_action(self, parsed_args): self.log.debug("take_action(%s)" % parsed_args) oooutils.ffwd_upgrade_operator_confirm(parsed_args.yes, self.log) clients = self.app.client_manager stack = oooutils.get_stack(clients.orchestration, parsed_args.stack) stack_name = stack.stack_name # In case of update and upgrade we need to force the # update_plan_only. The heat stack update is done by the # packag_update mistral action parsed_args.update_plan_only = True # Add the prepare environment into the args to unset noop etc templates_dir = (parsed_args.templates or constants.TRIPLEO_HEAT_TEMPLATES) if not parsed_args.environment_files: parsed_args.environment_files = [] parsed_args.environment_files = oooutils.prepend_environment( parsed_args.environment_files, templates_dir, constants.FFWD_UPGRADE_PREPARE_ENV) super(FFWDUpgradePrepare, self).take_action(parsed_args) package_update.update(clients, container=stack_name) oooutils.get_config( clients, container=stack_name, container_config='{}-config'.format(stack.stack_name)) overcloudrcs = deployment.create_overcloudrc( clients, container=stack_name) oooutils.write_overcloudrc(stack_name, overcloudrcs) # refresh stack info and enable ssh admin for Ansible-via-Mistral stack = oooutils.get_stack(clients.orchestration, parsed_args.stack) deployment.get_hosts_and_enable_ssh_admin( stack, parsed_args.overcloud_ssh_network, parsed_args.overcloud_ssh_user, self.get_key_pair(parsed_args), parsed_args.overcloud_ssh_port_timeout, verbosity=oooutils.playbook_verbosity(self=self) ) self.log.info("FFWD Upgrade Prepare on stack {0} complete.".format( parsed_args.stack))
def take_action(self, parsed_args): self.log.debug("take_action(%s)" % parsed_args) # Throw deprecation warning if service is enabled and # ask user if upgrade should still be continued. if parsed_args.environment_files: oooutils.check_deprecated_service_is_enabled( parsed_args.environment_files) clients = self.app.client_manager stack = oooutils.get_stack(clients.orchestration, parsed_args.stack) stack_name = stack.stack_name # In case of update and upgrade we need to force the # update_plan_only. The heat stack update is done by the # packag_update mistral action parsed_args.update_plan_only = True # Add the upgrade-prepare.yaml environment to set noops etc templates_dir = (parsed_args.templates or constants.TRIPLEO_HEAT_TEMPLATES) parsed_args.environment_files = oooutils.prepend_environment( parsed_args.environment_files, templates_dir, constants.UPGRADE_PREPARE_ENV) super(UpgradePrepare, self).take_action(parsed_args) package_update.update(clients, container=stack_name) oooutils.get_config(clients, container=stack_name, container_config='{}-config'.format( stack.stack_name)) overcloudrcs = deployment.create_overcloudrc(clients, container=stack_name) oooutils.write_overcloudrc(stack_name, overcloudrcs) # refresh stack info and enable ssh admin for Ansible-via-Mistral stack = oooutils.get_stack(clients.orchestration, parsed_args.stack) deployment.get_hosts_and_enable_ssh_admin( stack, parsed_args.overcloud_ssh_network, parsed_args.overcloud_ssh_user, self.get_key_pair(parsed_args), parsed_args.overcloud_ssh_port_timeout, verbosity=oooutils.playbook_verbosity(self=self)) self.log.info("Completed Overcloud Upgrade Prepare for stack " "{0}".format(stack_name))
def take_action(self, parsed_args): self.log.debug("take_action(%s)" % parsed_args) self._setup_clients(parsed_args) # Swiftclient logs things like 404s at error level, which is a problem # because we use EAFP to check for the existence of files. Turn off # most swiftclient logging to avoid cluttering up our output with # pointless tracebacks. sc_logger = logging.getLogger("swiftclient") sc_logger.setLevel(logging.CRITICAL) self._validate_args(parsed_args) # Throw warning if deprecated service is enabled and # ask user if deployment should still be continued. if parsed_args.environment_files: utils.check_deprecated_service_is_enabled( parsed_args.environment_files) stack = utils.get_stack(self.orchestration_client, parsed_args.stack) self._update_parameters(parsed_args, stack) stack_create = stack is None if stack_create: self.log.info("No stack found, will be doing a stack create") else: self.log.info("Stack found, will be doing a stack update") if parsed_args.dry_run: print("Validation Finished") return start = time.time() if not parsed_args.config_download_only: self._deploy_tripleo_heat_templates_tmpdir(stack, parsed_args) # Get a new copy of the stack after stack update/create. If it was # a create then the previous stack object would be None. stack = utils.get_stack(self.orchestration_client, parsed_args.stack) if parsed_args.update_plan_only: # If we are only updating the plan, then we either wont have a # stack yet or there wont be any changes and the following code # wont do anything. return if parsed_args.config_download: print("Deploying overcloud configuration") deployment.set_deployment_status( clients=self.clients, plan=stack.stack_name, status='DEPLOYING' ) try: if not parsed_args.config_download_only: deployment.get_hosts_and_enable_ssh_admin( stack, parsed_args.overcloud_ssh_network, parsed_args.overcloud_ssh_user, self.get_key_pair(parsed_args), parsed_args.overcloud_ssh_port_timeout, verbosity=utils.playbook_verbosity(self=self) ) if parsed_args.config_download_timeout: timeout = parsed_args.config_download_timeout else: used = int((time.time() - start) // 60) timeout = parsed_args.timeout - used if timeout <= 0: raise exceptions.DeploymentError( 'Deployment timed out after %sm' % used) deployment_options = {} if parsed_args.deployment_python_interpreter: deployment_options['ansible_python_interpreter'] = \ parsed_args.deployment_python_interpreter deployment.config_download( self.log, self.clients, stack, parsed_args.overcloud_ssh_network, parsed_args.output_dir, parsed_args.override_ansible_cfg, timeout=parsed_args.overcloud_ssh_port_timeout, verbosity=utils.playbook_verbosity(self=self), deployment_options=deployment_options, in_flight_validations=parsed_args.inflight, deployment_timeout=timeout, tags=parsed_args.tags, skip_tags=parsed_args.skip_tags, limit_hosts=utils.playbook_limit_parse( limit_nodes=parsed_args.limit ) ) deployment.set_deployment_status( clients=self.clients, plan=stack.stack_name, status='DEPLOY_SUCCESS') except Exception: deployment.set_deployment_status( clients=self.clients, plan=stack.stack_name, status='DEPLOY_FAILED' ) raise # Force fetching of attributes stack.get() rcpath = deployment.create_overcloudrc(container=stack.stack_name, no_proxy=parsed_args.no_proxy) # Copy clouds.yaml to the cloud user directory user = getpwuid(os.stat(constants.CLOUD_HOME_DIR).st_uid).pw_name utils.copy_clouds_yaml(user) utils.create_tempest_deployer_input() # Run postconfig on create or force. Use force to makes sure endpoints # are created with deploy reruns and upgrades if (stack_create or parsed_args.force_postconfig and not parsed_args.skip_postconfig): self._deploy_postconfig(stack, parsed_args) overcloud_endpoint = utils.get_overcloud_endpoint(stack) horizon_url = deployment.get_horizon_url(stack=stack.stack_name) print("Overcloud Endpoint: {0}".format(overcloud_endpoint)) print("Overcloud Horizon Dashboard URL: {0}".format(horizon_url)) print("Overcloud rc file: {0}".format(rcpath)) print("Overcloud Deployed")
def take_action(self, parsed_args): self.log.debug("take_action(%s)" % parsed_args) self._setup_clients(parsed_args) # Swiftclient logs things like 404s at error level, which is a problem # because we use EAFP to check for the existence of files. Turn off # most swiftclient logging to avoid cluttering up our output with # pointless tracebacks. sc_logger = logging.getLogger("swiftclient") sc_logger.setLevel(logging.CRITICAL) self._validate_args(parsed_args) # Throw warning if deprecated service is enabled and # ask user if deployment should still be continued. if parsed_args.environment_files: utils.check_deprecated_service_is_enabled( parsed_args.environment_files) stack = utils.get_stack(self.orchestration_client, parsed_args.stack) if stack and stack.stack_status == 'IN_PROGRESS': raise exceptions.StackInProgress( "Unable to deploy as the stack '{}' status is '{}'".format( stack.stack_name, stack.stack_status)) self._update_parameters(parsed_args, stack) stack_create = stack is None if stack_create: self.log.info("No stack found, will be doing a stack create") else: self.log.info("Stack found, will be doing a stack update") if parsed_args.dry_run: print("Validation Finished") return start = time.time() if not parsed_args.config_download_only: self._deploy_tripleo_heat_templates_tmpdir(stack, parsed_args) # Get a new copy of the stack after stack update/create. If it was # a create then the previous stack object would be None. stack = utils.get_stack(self.orchestration_client, parsed_args.stack) if parsed_args.update_plan_only: # If we are only updating the plan, then we either wont have a # stack yet or there wont be any changes and the following code # wont do anything. return if parsed_args.config_download: print("Deploying overcloud configuration") deployment.set_deployment_status( self.clients, 'deploying', plan=stack.stack_name) try: if not parsed_args.config_download_only: deployment.get_hosts_and_enable_ssh_admin( self.log, self.clients, stack, parsed_args.overcloud_ssh_network, parsed_args.overcloud_ssh_user, parsed_args.overcloud_ssh_key) if parsed_args.config_download_timeout: timeout = parsed_args.config_download_timeout * 60 else: used = int(time.time() - start) timeout = (parsed_args.timeout * 60) - used deployment_options = {} if parsed_args.deployment_python_interpreter: deployment_options['ansible_python_interpreter'] = \ parsed_args.deployment_python_interpreter deployment.config_download( self.log, self.clients, stack, parsed_args.templates, parsed_args.overcloud_ssh_user, parsed_args.overcloud_ssh_key, parsed_args.overcloud_ssh_network, parsed_args.output_dir, parsed_args.override_ansible_cfg, timeout, verbosity=self.app_args.verbose_level, deployment_options=deployment_options, in_flight_validations=parsed_args.inflight) except Exception: deployment.set_deployment_status( self.clients, 'failed', plan=stack.stack_name) raise # Force fetching of attributes stack.get() overcloudrcs = deployment.create_overcloudrc( self.clients, container=stack.stack_name, no_proxy=parsed_args.no_proxy) # Create overcloud clouds.yaml cloud_data = deployment.create_cloudsyaml( self.clients, container=stack.stack_name) cloud_yaml_dir = os.path.join(constants.CLOUD_HOME_DIR, constants.CLOUDS_YAML_DIR) cloud_user_id = os.stat(constants.CLOUD_HOME_DIR).st_uid cloud_group_id = os.stat(constants.CLOUD_HOME_DIR).st_gid clouds_yaml.create_clouds_yaml( cloud=cloud_data, cloud_yaml_dir=cloud_yaml_dir, user_id=cloud_user_id, group_id=cloud_group_id) rcpath = utils.write_overcloudrc(stack.stack_name, overcloudrcs) utils.create_tempest_deployer_input() # Run postconfig on create or force. Use force to makes sure endpoints # are created with deploy reruns and upgrades if (stack_create or parsed_args.force_postconfig and not parsed_args.skip_postconfig): self._deploy_postconfig(stack, parsed_args) overcloud_endpoint = utils.get_overcloud_endpoint(stack) horizon_url = deployment.get_horizon_url( self.clients, stack=stack.stack_name) print("Overcloud Endpoint: {0}".format(overcloud_endpoint)) print("Overcloud Horizon Dashboard URL: {0}".format(horizon_url)) print("Overcloud rc file: {0}".format(rcpath)) print("Overcloud Deployed")