mirror of
https://github.com/valitydev/salt.git
synced 2024-11-09 01:36:48 +00:00
Merge pull request #2378 from giantlock/develop
freebsdservice.get_enabled() fix
This commit is contained in:
commit
69ff6cef23
@ -16,6 +16,7 @@ def __virtual__():
|
||||
return 'service'
|
||||
return False
|
||||
|
||||
|
||||
def get_enabled():
|
||||
'''
|
||||
Return what services are set to run on boot
|
||||
@ -28,18 +29,13 @@ def get_enabled():
|
||||
for rcfn in ('/etc/rc.conf', '/etc/rc.conf.local'):
|
||||
if os.path.isfile(rcfn):
|
||||
for line in open(rcfn, 'r').readlines():
|
||||
if not line.strip():
|
||||
clean_line = line.split('#',1)[0].strip()
|
||||
if not '_enable=' in clean_line:
|
||||
continue
|
||||
if line.startswith('#'):
|
||||
(service, enabled) = clean_line.split('=')
|
||||
if enabled.strip('"\'').upper() != 'YES':
|
||||
continue
|
||||
if not '_enable' in line:
|
||||
continue
|
||||
if not '=' in line:
|
||||
continue
|
||||
comps = line.split('=')
|
||||
if 'YES' in comps[1]:
|
||||
# Is enabled!
|
||||
ret.append(comps[0].split('_')[0])
|
||||
ret.append(service.replace('_enable', ''))
|
||||
return ret
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user