def _restart(): cmd = _config['RESTART_COMMAND'] logger.warn('Restarting using command: %s' % ' '.join(cmd)) # save restarting state in database state = get_current_state() state.geoserver_restarting = True state.save() return_code = subprocess.call(cmd) if return_code != 0: logger.error('Failure executing restart command: %s' % ' '.join(cmd)) logger.error('Received error response code: %s' % return_code) return False # instead of trying to detect whether tomcat shut down correctly, # sleep for a few seconds time.sleep(10) if verify_geoserver_running(attempt=1): state.geoserver_restarting = False state.save() return True return False
error_message('Failure Restarting Geoserver') # send out any error messages immediately _send_error_mails() # keep track of state from runs in database current_log = memory_log_handler.contents() is_error = bool(_errors) if is_error: separator = '\n\n%s\n\n' % ('=' * 80) errors = separator.join([str(error) for error in _errors]) else: errors = None current_state = get_current_state() current_state.is_error = is_error current_state.save() run = Run(suites='\n'.join(suites), log=current_log, is_error=is_error, errors=errors) run.save() def error_message(msg): """these messages will get emailed out immediately after the run""" logger.error(msg) _error_messages.append(msg)