def stop_haproxy(self, component_dir): # We much check whether the pidfile for agent exists, it won't if --fg was given on input in which case # Ctrl-C must have closed the agent thus we cannot send any signal. lb_agent_pidfile = get_haproxy_agent_pidfile(component_dir) if os.path.exists(lb_agent_pidfile): self.signal('Load-balancer\'s agent', 'SIGTERM', signal.SIGTERM, lb_agent_pidfile, component_dir) self.signal('Load-balancer', 'SIGTERM', signal.SIGTERM, None, component_dir)
def _on_lb(self, *ignored): self.run_check_config() def stop_haproxy(): Stop(self.args).stop_haproxy(self.component_dir) found_pidfile = self.check_pidfile() if not found_pidfile: found_agent_pidfile = self.check_pidfile(get_haproxy_agent_pidfile(self.component_dir)) if not found_agent_pidfile: self.start_component( 'zato.agent.load_balancer.main', 'load-balancer', os.path.join(self.config_dir, 'repo'), stop_haproxy) return # Will be returned if either of pidfiles was found sys.exit(self.SYS_ERROR.FOUND_PIDFILE)