From c96a85fb70a76f24f5c64deb618ae8d0335e6961 Mon Sep 17 00:00:00 2001 From: David Fritzsche Date: Fri, 31 Oct 2014 11:41:51 +0100 Subject: [PATCH] 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. --- system/service.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/system/service.py b/system/service.py index 6093717bcee..e75f5ba74d5 100644 --- a/system/service.py +++ b/system/service.py @@ -913,10 +913,13 @@ class FreeBsdService(Service): def get_service_status(self): rc, stdout, stderr = self.execute_command("%s %s %s %s" % (self.svc_cmd, self.name, 'onestatus', self.arguments)) - if rc == 1: - self.running = False - elif rc == 0: - self.running = True + if self.name == "pf": + self.running = "Enabled" in stdout + else: + if rc == 1: + self.running = False + elif rc == 0: + self.running = True def service_enable(self): if self.enable: