Add working status detection for pf on FreeBSD

The return code of "service pf onestatus" is usually zero on FreeBSD (tested with FreeBSD 10.0), even if pf is not running. So the service module always thinks that pf is running, even when it needs to be started.
This commit is contained in:
David Fritzsche 2014-10-31 11:41:51 +01:00
parent 63e81cfc2e
commit c96a85fb70

View file

@ -913,6 +913,9 @@ class FreeBsdService(Service):
def get_service_status(self): def get_service_status(self):
rc, stdout, stderr = self.execute_command("%s %s %s %s" % (self.svc_cmd, self.name, 'onestatus', self.arguments)) rc, stdout, stderr = self.execute_command("%s %s %s %s" % (self.svc_cmd, self.name, 'onestatus', self.arguments))
if self.name == "pf":
self.running = "Enabled" in stdout
else:
if rc == 1: if rc == 1:
self.running = False self.running = False
elif rc == 0: elif rc == 0: