From e93fbedcc74df8e5c380e12d52a8403b93c720dc Mon Sep 17 00:00:00 2001 From: Antonio Huete Jimenez Date: Thu, 24 May 2018 00:38:10 +0200 Subject: [PATCH] service: More DragonFly BSD support (#40449) - Use NetBSD's service_enable which sets the vars correctly in /etc/rc.conf --- lib/ansible/modules/system/service.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lib/ansible/modules/system/service.py b/lib/ansible/modules/system/service.py index d8d648034c..6061806345 100644 --- a/lib/ansible/modules/system/service.py +++ b/lib/ansible/modules/system/service.py @@ -1089,6 +1089,21 @@ class DragonFlyBsdService(FreeBsdService): platform = 'DragonFly' distribution = None + def service_enable(self): + if self.enable: + self.rcconf_value = "YES" + else: + self.rcconf_value = "NO" + + rcfiles = ['/etc/rc.conf'] # Overkill? + for rcfile in rcfiles: + if os.path.isfile(rcfile): + self.rcconf_file = rcfile + + self.rcconf_key = "%s" % string.replace(self.name, "-", "_") + + return self.service_enable_rcconf() + class OpenBsdService(Service): """