def __exit__(self, type, value, traceback): ''' Kill the minion and master processes ''' try: if hasattr(self.sub_minion_process, 'terminate'): self.sub_minion_process.terminate() else: log.error('self.sub_minion_process can\'t be terminate.') except AttributeError: pass try: if hasattr(self.minion_process, 'terminate'): self.minion_process.terminate() else: log.error('self.minion_process can\'t be terminate.') except AttributeError: pass try: if hasattr(self.sub_master_process, 'terminate'): self.sub_master_process.terminate() else: log.error('self.sub_master_process can\'t be terminate.') except AttributeError: pass try: if hasattr(self.master_process, 'terminate'): self.master_process.terminate() else: log.error('self.master_process can\'t be terminate.') except AttributeError: pass self._exit_mockbin() self._exit_ssh() # Shutdown the multiprocessing logging queue listener salt_log_setup.shutdown_multiprocessing_logging() salt_log_setup.shutdown_multiprocessing_logging_listener( daemonizing=True) # Shutdown the log server self.log_server.shutdown() self.log_server.server_close() self.log_server_process.join()
def __exit__(self, type, value, traceback): ''' Kill the minion and master processes ''' self.sub_minion_process.terminate() self.minion_process.terminate() if hasattr(self, 'proxy_process'): self.proxy_process.terminate() self.master_process.terminate() try: self.syndic_process.terminate() except AttributeError: pass try: self.smaster_process.terminate() except AttributeError: pass #salt.utils.process.clean_proc(self.sub_minion_process, wait_for_kill=50) #self.sub_minion_process.join() #salt.utils.process.clean_proc(self.minion_process, wait_for_kill=50) #self.minion_process.join() #salt.utils.process.clean_proc(self.master_process, wait_for_kill=50) #self.master_process.join() #try: # salt.utils.process.clean_proc(self.syndic_process, wait_for_kill=50) # self.syndic_process.join() #except AttributeError: # pass #try: # salt.utils.process.clean_proc(self.smaster_process, wait_for_kill=50) # self.smaster_process.join() #except AttributeError: # pass self.log_server.server_close() self.log_server.shutdown() self._exit_mockbin() self._exit_ssh() self.log_server_process.join() # Shutdown the multiprocessing logging queue listener salt_log_setup.shutdown_multiprocessing_logging() salt_log_setup.shutdown_multiprocessing_logging_listener(daemonizing=True)