mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Handle CommandExecutionError in grains commands
Since we switched to python_shell=False, commands throw exceptions when not found, rather than just having a non-zero retcode (since we're not using a shell). Catch these exceptions and handle them the same way as non-zero retcodes.
This commit is contained in:
parent
86a3b317c6
commit
85b91d64cc
1 changed files with 9 additions and 2 deletions
|
@ -497,9 +497,16 @@ def _virtual(osdata):
|
|||
|
||||
cmd = '{0} {1}'.format(command, ' '.join(args))
|
||||
|
||||
ret = __salt__['cmd.run_all'](cmd)
|
||||
try:
|
||||
ret = __salt__['cmd.run_all'](cmd)
|
||||
|
||||
if ret['retcode'] > 0:
|
||||
if ret['retcode'] > 0:
|
||||
if salt.log.is_logging_configured():
|
||||
if salt.utils.is_windows():
|
||||
continue
|
||||
failed_commands.add(command)
|
||||
continue
|
||||
except salt.exceptions.CommandExecutionError:
|
||||
if salt.log.is_logging_configured():
|
||||
if salt.utils.is_windows():
|
||||
continue
|
||||
|
|
Loading…
Add table
Reference in a new issue