mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 17:09:03 +00:00
Move command logging to before win_runas
With the addition of runas for Windows in 2016.3.0, commands run using Windows runas would not be logged at all, as we would return from the _run() function before we got to the line where this information was logged. This commit moves the command logging up to before we enter the if block where the win_runas code would be executed, restoring the prior logging behavior.
This commit is contained in:
parent
91eafddda6
commit
2e56527ead
@ -303,6 +303,22 @@ def _run(cmd,
|
||||
'Setting value to an empty string'.format(bad_env_key))
|
||||
env[bad_env_key] = ''
|
||||
|
||||
if _check_loglevel(output_loglevel) is not None:
|
||||
# Always log the shell commands at INFO unless quiet logging is
|
||||
# requested. The command output is what will be controlled by the
|
||||
# 'loglevel' parameter.
|
||||
msg = (
|
||||
'Executing command {0}{1}{0} {2}in directory \'{3}\'{4}'.format(
|
||||
'\'' if not isinstance(cmd, list) else '',
|
||||
cmd,
|
||||
'as user \'{0}\' '.format(runas) if runas else '',
|
||||
cwd,
|
||||
'. Executing command in the background, no output will be '
|
||||
'logged.' if bg else ''
|
||||
)
|
||||
)
|
||||
log.info(log_callback(msg))
|
||||
|
||||
if runas and salt.utils.is_windows():
|
||||
if not password:
|
||||
msg = 'password is a required argument for runas on Windows'
|
||||
@ -368,21 +384,6 @@ def _run(cmd,
|
||||
)
|
||||
)
|
||||
|
||||
if _check_loglevel(output_loglevel) is not None:
|
||||
# Always log the shell commands at INFO unless quiet logging is
|
||||
# requested. The command output is what will be controlled by the
|
||||
# 'loglevel' parameter.
|
||||
msg = (
|
||||
'Executing command {0}{1}{0} {2}in directory \'{3}\'{4}'.format(
|
||||
'\'' if not isinstance(cmd, list) else '',
|
||||
cmd,
|
||||
'as user \'{0}\' '.format(runas) if runas else '',
|
||||
cwd,
|
||||
' in the background, no output will be logged' if bg else ''
|
||||
)
|
||||
)
|
||||
log.info(log_callback(msg))
|
||||
|
||||
if reset_system_locale is True:
|
||||
if not salt.utils.is_windows():
|
||||
# Default to C!
|
||||
|
Loading…
Reference in New Issue
Block a user