mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
module_utils_service: Fix glob path of rc.d (#43018)
Some distribtuions like SUSE has the rc%.d directories under /etc/init.d Quote of /etc/rc.d.README on SLES11. "Some people expect the system startup scripts in /etc/rc.d/. We use a slightly different structure for better LSB compliance."
This commit is contained in:
parent
af55b8e992
commit
29a62038b7
2 changed files with 8 additions and 0 deletions
4
changelogs/fragments/service.yml
Normal file
4
changelogs/fragments/service.yml
Normal file
|
@ -0,0 +1,4 @@
|
|||
---
|
||||
bugfixes:
|
||||
- Fix glob path of rc.d
|
||||
Some distribtuions like SUSE has the rc%.d directories under /etc/init.d
|
|
@ -48,8 +48,12 @@ def sysv_is_enabled(name, runlevel=None):
|
|||
:kw runlevel: runlevel to check (default: None)
|
||||
'''
|
||||
if runlevel:
|
||||
if not os.path.isdir('/etc/rc0.d/'):
|
||||
return bool(glob.glob('/etc/init.d/rc%s.d/S??%s' % (runlevel, name)))
|
||||
return bool(glob.glob('/etc/rc%s.d/S??%s' % (runlevel, name)))
|
||||
else:
|
||||
if not os.path.isdir('/etc/rc0.d/'):
|
||||
return bool(glob.glob('/etc/init.d/rc?.d/S??%s' % name))
|
||||
return bool(glob.glob('/etc/rc?.d/S??%s' % name))
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue