mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Fix service enable on FreeBSD
Some services have a knob (i.e. rc.conf setting) whose name differs from that of the script. For example, lockd process is controlled with a script called lockd, but the rc.conf value is rpc_lockd_enable. Fixes issue #3382.
This commit is contained in:
parent
25aaee4c38
commit
93fc3391fe
1 changed files with 8 additions and 1 deletions
|
@ -694,7 +694,14 @@ class FreeBsdService(Service):
|
||||||
if os.path.isfile(rcfile):
|
if os.path.isfile(rcfile):
|
||||||
self.rcconf_file = rcfile
|
self.rcconf_file = rcfile
|
||||||
|
|
||||||
self.rcconf_key = "%s_enable" % self.name
|
rc, stdout, stderr = self.execute_command("%s %s %s %s" % (self.svc_cmd, self.name, 'rcvar', self.arguments))
|
||||||
|
rcvars = shlex.split(stdout, comments=True)
|
||||||
|
if not rcvars:
|
||||||
|
self.module.fail_json(msg="unable to determine rcvar")
|
||||||
|
|
||||||
|
# In rare cases, i.e. sendmail, rcvar can return several key=value pairs
|
||||||
|
# Usually there is just one, however.
|
||||||
|
self.rcconf_key = rcvars[0].split('=')[0]
|
||||||
|
|
||||||
return self.service_enable_rcconf()
|
return self.service_enable_rcconf()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue