salt.states.cmd: fixed 'unless' behaviour in case of multiple unless commands are given

This commit is contained in:
kitsemets 2015-01-27 22:45:50 +02:00
parent b96b852aa1
commit 6677a0a13e

View File

@ -324,10 +324,11 @@ def mod_run_check(cmd_kwargs, onlyif, unless, group, creates):
'skip_watch': True,
'result': True}
elif isinstance(unless, list):
cmd = []
for entry in unless:
cmd = __salt__['cmd.retcode'](entry, ignore_retcode=True, python_shell=True, **cmd_kwargs)
cmd.append(__salt__['cmd.retcode'](entry, ignore_retcode=True, python_shell=True, **cmd_kwargs))
log.debug('Last command return code: {0}'.format(cmd))
if cmd == 0:
if all([c == 0 for c in cmd]):
return {'comment': 'unless execution succeeded',
'skip_watch': True,
'result': True}