mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 09:23:56 +00:00
Merge pull request #50733 from marmarek/patch-3
Report salt-call exit code from ssh_py_shim.py
This commit is contained in:
commit
cb85d5d31f
@ -292,19 +292,23 @@ def main(argv): # pylint: disable=W0613
|
|||||||
if OPTIONS.cmd_umask is not None:
|
if OPTIONS.cmd_umask is not None:
|
||||||
old_umask = os.umask(OPTIONS.cmd_umask) # pylint: disable=blacklisted-function
|
old_umask = os.umask(OPTIONS.cmd_umask) # pylint: disable=blacklisted-function
|
||||||
if OPTIONS.tty:
|
if OPTIONS.tty:
|
||||||
|
proc = subprocess.Popen(salt_argv, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||||
# Returns bytes instead of string on python 3
|
# Returns bytes instead of string on python 3
|
||||||
stdout, _ = subprocess.Popen(salt_argv, stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()
|
stdout, _ = proc.communicate()
|
||||||
sys.stdout.write(stdout.decode(encoding=get_system_encoding(), errors="replace"))
|
sys.stdout.write(stdout.decode(encoding=get_system_encoding(), errors="replace"))
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
|
retcode = proc.returncode
|
||||||
if OPTIONS.wipe:
|
if OPTIONS.wipe:
|
||||||
shutil.rmtree(OPTIONS.saltdir)
|
shutil.rmtree(OPTIONS.saltdir)
|
||||||
elif OPTIONS.wipe:
|
elif OPTIONS.wipe:
|
||||||
subprocess.call(salt_argv)
|
retcode = subprocess.call(salt_argv)
|
||||||
shutil.rmtree(OPTIONS.saltdir)
|
shutil.rmtree(OPTIONS.saltdir)
|
||||||
else:
|
else:
|
||||||
subprocess.call(salt_argv)
|
retcode = subprocess.call(salt_argv)
|
||||||
if OPTIONS.cmd_umask is not None:
|
if OPTIONS.cmd_umask is not None:
|
||||||
os.umask(old_umask) # pylint: disable=blacklisted-function
|
os.umask(old_umask) # pylint: disable=blacklisted-function
|
||||||
|
return retcode
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
sys.exit(main(sys.argv))
|
sys.exit(main(sys.argv))
|
||||||
|
Loading…
Reference in New Issue
Block a user