mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 08:58:59 +00:00
Move service name logic to a separate function
This commit is contained in:
parent
2fddba3713
commit
b49b018c6b
@ -410,6 +410,13 @@ def master_event(type, master=None):
|
||||
return event_map.get(type, None)
|
||||
|
||||
|
||||
def service_name():
|
||||
'''
|
||||
Return the proper service name based on platform
|
||||
'''
|
||||
return 'salt_minion' if 'bsd' in sys.platform else 'salt-minion'
|
||||
|
||||
|
||||
class MinionBase(object):
|
||||
def __init__(self, opts):
|
||||
self.opts = opts
|
||||
@ -2620,10 +2627,7 @@ class Minion(MinionBase):
|
||||
delay = self.opts.get('random_reauth_delay', 5)
|
||||
log.info('delaying random_reauth_delay %ss', delay)
|
||||
try:
|
||||
self.functions['service.restart'](
|
||||
'salt_minion' if 'bsd' in sys.platform
|
||||
else 'salt-minion'
|
||||
)
|
||||
self.functions['service.restart'](service_name())
|
||||
except KeyError:
|
||||
# Probably no init system (running in docker?)
|
||||
log.warning(
|
||||
|
Loading…
Reference in New Issue
Block a user