mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 09:23:56 +00:00
openbsd-rcctl: use new syntax to speed up listing services
I just introduced a new subcommand to rcctl(8) in OpenBSD that allows querying for services (all, enabled, disabled, ...) so make salt use it.
This commit is contained in:
parent
f9b8567c06
commit
487c05f9e6
@ -91,12 +91,9 @@ def get_all():
|
||||
|
||||
salt '*' service.get_all
|
||||
'''
|
||||
badvar = ("_timeout", "_user")
|
||||
ret = []
|
||||
service = _cmd()
|
||||
for svc in __salt__['cmd.run']('{0} getall'.format(service)).splitlines():
|
||||
svc = re.sub('(_flags|)=.*$', '', svc)
|
||||
if not svc.endswith(badvar):
|
||||
for svc in __salt__['cmd.run']('{0} ls all'.format(service)).splitlines():
|
||||
ret.append(svc)
|
||||
return sorted(ret)
|
||||
|
||||
@ -111,14 +108,10 @@ def get_disabled():
|
||||
|
||||
salt '*' service.get_disabled
|
||||
'''
|
||||
badvar = ("_timeout", "_user")
|
||||
ret = []
|
||||
service = _cmd()
|
||||
for svc in __salt__['cmd.run']('{0} getall'.format(service)).splitlines():
|
||||
if svc.endswith("=NO"):
|
||||
svc = re.sub('(_flags|)=.*$', '', svc)
|
||||
if not svc.endswith(badvar):
|
||||
ret.append(svc)
|
||||
for svc in __salt__['cmd.run']('{0} ls off'.format(service)).splitlines():
|
||||
ret.append(svc)
|
||||
return sorted(ret)
|
||||
|
||||
|
||||
@ -132,14 +125,10 @@ def get_enabled():
|
||||
|
||||
salt '*' service.get_enabled
|
||||
'''
|
||||
badvar = ("_timeout", "_user")
|
||||
ret = []
|
||||
service = _cmd()
|
||||
for svc in __salt__['cmd.run']('{0} getall'.format(service)).splitlines():
|
||||
if not svc.endswith("=NO"):
|
||||
svc = re.sub('(_flags|)=.*$', '', svc)
|
||||
if not svc.endswith(badvar):
|
||||
ret.append(svc)
|
||||
for svc in __salt__['cmd.run']('{0} ls on'.format(service)).splitlines():
|
||||
ret.append(svc)
|
||||
return sorted(ret)
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user