def onFinalizing(self): util.printAction('Finalizing') if self.wrapper.isAbort(): util.printError("Failed") else: util.printAction('Done!')
def onSendingReports(self): util.printAction('Sending report') if self._need_to_send_reports(): self._execute_report_target_and_send_reports() self._unset_need_to_send_reports() else: util.printDetail('INFO: Conditionally skipped sending reports.', verboseThreshold=util.VERBOSE_LEVEL_QUIET) self.wrapper.set_scale_state_operational()
def onSendingFinalReport(self): util.printAction('Sending report') try: self._executeTarget('report') except ExecutionException as ex: util.printDetail("Failed executing 'report' with: \n%s" % str(ex), verboseLevel=self.verboseLevel, verboseThreshold=util.VERBOSE_LEVEL_NORMAL) raise finally: super(NodeDeploymentExecutor, self).onSendingFinalReport()
def onSendingFinalReport(self): util.printAction('Sending report') reportFileName = '%s_report_%s.tgz' % ( self._nodename(), util.toTimeInIso8601NoColon(time.time())) try: archive = tarfile.open(reportFileName, 'w:gz') for element in self.reportFilesAndDirsList: archive.add(element) except Exception as e: raise RuntimeError("Failed to bundle reports:\n%s" % e) archive.close() self.wrapper.clientSlipStream.sendReport(reportFileName)
def onInitializing(self): util.printAction('Initializing') util.printStep('Starting instances') try: self.wrapper.startImages() except Exceptions.AbortException: pass except Exception as ex: util.printError('Error starting instances with error: %s' % ex) raise util.printStep('Publishing instance initialization information') self.wrapper.publishDeploymentInitializationInfo()
def onInitializing(self): util.printAction('Initializing') self._addSshPubkeyIfNeeded() util.printStep('Getting deployment targets') self.targets = self.wrapper.getTargets() util.printDetail('Deployment targets:') for target, script in self.targets.items(): util.printAndFlush('-' * 25) util.printDetail('Target: %s' % target) util.printDetail('Script:\n%s\n' % script[0])
def onSendingReports(self): util.printAction('Sending reports') reportFileName = '%s_report_%s.tgz' % ( self._get_node_instance_name(), util.toTimeInIso8601NoColon(time.time())) reportFileName = os.path.join(tempfile.gettempdir(), reportFileName) try: archive = tarfile.open(reportFileName, 'w:gz') for element in self.reportFilesAndDirsList: name = '_'.join(os.path.abspath(element).strip(os.sep).split(os.sep)) archive.add(os.path.expandvars(element), name) except Exception as e: raise RuntimeError("Failed to bundle reports:\n%s" % e) archive.close() self.wrapper.send_report(reportFileName)
def onTerminal(self): util.printAction('Terminating') util.printStep('Stopping instances') try: self.wrapper.stopNodes() except Exceptions.AbortException: pass except Exception as ex: util.printError('Error stopping instances: %s' % ex) raise util.printStep('Publishing instance termination information') self.wrapper.publishDeploymentTerminateInfo() super(OrchestratorDeploymentExecutor, self).onTerminal() self._killItself()
def onExecuting(self): util.printAction('Executing') self._get_recovery_mode() if self._is_recovery_mode(): util.printDetail( "Recovery mode enabled, recipes will not be executed.", verboseThreshold=util.VERBOSE_LEVEL_QUIET) return if self._skip_execute_due_to_vertical_scaling: util.printDetail( "Vertical scaling: skipping execution of execute targets.", verboseThreshold=util.VERBOSE_LEVEL_QUIET) self._skip_execute_due_to_vertical_scaling = False return if not self.wrapper.is_scale_state_operational(): self._execute_build_recipes() self._execute_execute_target() else: self._execute_scale_action_target()
def _test_start_stop_images(self): "Live test that starts and stops VMs on a cloud." self.client.run_category = RUN_CATEGORY_DEPLOYMENT success = True error = '' try: self.client.start_nodes_and_clients(self.user_info, self.node_instances) vms = self.client.get_vms() assert len(vms) == self.multiplicity util.printAction('Instances started.') pp(vms) except Exception as ex: success = False error = self._get_ex_msg(ex) util.printError("Exception caught while starting instances!") exc_type, exc_value, exc_traceback = sys.exc_info() traceback.print_exception(exc_type, exc_value, exc_traceback) finally: util.printAction("Stopping deployment.") self.client.stop_deployment() self.assertEquals(success, True, error)
def _test_start_stop_images(self): "Live test that starts and stops VMs on a cloud." self.client.run_category = RUN_CATEGORY_DEPLOYMENT success = True error = '' try: self.client.start_nodes_and_clients(self.user_info, self.node_instances) vms = self.client.get_vms() assert len(vms) == self.multiplicity util.printAction('Instances started.') pp(vms) except Exception as ex: success = False error = self._get_ex_msg(ex) util.printError("Exception caught while starting instances!") exc_type, exc_value, exc_traceback = sys.exc_info() traceback.print_exception(exc_type, exc_value, exc_traceback) finally: util.printAction("Stopping deployment.") self.client.stop_deployment() self.assertEquals(success, True, error)
def onInitializing(self): util.printAction('Initializing')
def onInitializing(self): util.printAction('Node image creation sequence') util.printDetail("Nothing to do from within the image, " "the orchestrator will do the work.", 0)
def onInitializing(self): util.printAction('Initializing')
def onProvisioning(self): util.printAction('Provisioning') self._clean_user_info_cache() self._clean_local_cache()
def onRunning(self): util.printAction('Running') self._executeTarget('execute')
def onExecuting(self): util.printAction('Executing')
def onProvisioning(self): util.printAction('Node image creation sequence') util.printDetail( "Nothing to do from within the image, " "the orchestrator will do the work.", 0)
def onReady(self): util.printAction('Ready')
def onRunning(self): util.printAction('Running')
def onFinalizing(self): util.printAction('Finalizing')
def onTerminal(self): if self.wrapper.isAbort(): util.printError("Failed") else: util.printAction('Done!')