def enable(self): """ Enable backend in HAProxy, by management socket """ """ Cannot enable a disabled frontend ('enable' field) """ if not self.enabled: raise ServiceError("Cannot start a disabled backend.", "haproxy", "enable backend", traceback="Please edit, enable and save a backend to start-it.") return hot_action_backend(self.name, "enable")
def disable(self): """ Disable frontend in HAProxy, by management socket """ if not self.enabled: return "This frontend is already disabled." """ If it is an Rsyslog only conf, return error """ if self.mode == "log" and self.listening_mode == "udp": raise ServiceError("Cannot hot disable an Rsyslog only frontend.", "rsyslog", "disable frontend", traceback="Please edit, disable and save the frontend.") return hot_action_backend(self.name, "disable")