mirror of
https://github.com/valitydev/salt.git
synced 2024-11-09 01:36:48 +00:00
Fix mod_watch for supervisord state
The "update" param was not being taken into account by mod_watch, causing parameters to be passed in the wrong order and ignoring the "update" param altogether. This commit corrects that. Fixes #6021.
This commit is contained in:
parent
16d9ebc9cd
commit
fb6c8d26c1
@ -30,9 +30,11 @@ def _check_error(result, success_message):
|
|||||||
|
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
|
|
||||||
def _is_stopped_state(state):
|
def _is_stopped_state(state):
|
||||||
return state in ('STOPPED', 'STOPPING', 'EXITED', 'FATAL')
|
return state in ('STOPPED', 'STOPPING', 'EXITED', 'FATAL')
|
||||||
|
|
||||||
|
|
||||||
def running(name,
|
def running(name,
|
||||||
restart=False,
|
restart=False,
|
||||||
update=False,
|
update=False,
|
||||||
@ -94,7 +96,7 @@ def running(name,
|
|||||||
ret.update(_check_error(result, comment))
|
ret.update(_check_error(result, comment))
|
||||||
changes.append(comment)
|
changes.append(comment)
|
||||||
log.debug(comment)
|
log.debug(comment)
|
||||||
|
|
||||||
elif update:
|
elif update:
|
||||||
comment = 'Updating supervisor'
|
comment = 'Updating supervisor'
|
||||||
result = __salt__['supervisord.update'](
|
result = __salt__['supervisord.update'](
|
||||||
@ -124,7 +126,7 @@ def running(name,
|
|||||||
elif just_updated:
|
elif just_updated:
|
||||||
comment = 'Not starting updated service: {0}'.format(name)
|
comment = 'Not starting updated service: {0}'.format(name)
|
||||||
result = comment
|
result = comment
|
||||||
ret.update({'comment': comment})
|
ret.update({'comment': comment})
|
||||||
else:
|
else:
|
||||||
comment = 'Not starting already running service: {0}'.format(name)
|
comment = 'Not starting already running service: {0}'.format(name)
|
||||||
result = comment
|
result = comment
|
||||||
@ -146,6 +148,7 @@ def running(name,
|
|||||||
ret['changes'][name] = ' '.join(changes)
|
ret['changes'][name] = ' '.join(changes)
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
|
|
||||||
def dead(name,
|
def dead(name,
|
||||||
runas=None,
|
runas=None,
|
||||||
conf_file=None,
|
conf_file=None,
|
||||||
@ -191,10 +194,12 @@ def dead(name,
|
|||||||
log.debug(unicode(result))
|
log.debug(unicode(result))
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
|
|
||||||
def mod_watch(name,
|
def mod_watch(name,
|
||||||
restart=None,
|
restart=False,
|
||||||
|
update=False,
|
||||||
runas=None,
|
runas=None,
|
||||||
conf_file=None,
|
conf_file=None,
|
||||||
bin_env=None):
|
bin_env=None):
|
||||||
# Always restart on watch
|
# Always restart on watch
|
||||||
return running(name, True, runas, conf_file, bin_env)
|
return running(name, True, update, runas, conf_file, bin_env)
|
||||||
|
Loading…
Reference in New Issue
Block a user