From 6341361a5ba3da6a51a4f58dcbe8357e1443440d Mon Sep 17 00:00:00 2001 From: Michael DeHaan Date: Fri, 27 Apr 2012 01:36:31 -0400 Subject: [PATCH] Clarify that stderr WILL crash your module. Can't redirect because if we do we lose tracebacks from modules remotely when they fail to parse, and this is VERY useful data. --- hacking/test-module | 5 ++--- lib/ansible/connection.py | 3 +-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/hacking/test-module b/hacking/test-module index 901839f8f33..58feee3df9f 100755 --- a/hacking/test-module +++ b/hacking/test-module @@ -63,8 +63,9 @@ cmd = subprocess.Popen("%s %s" % (modfile, argspath), if err and err != '': print "***********************************" - print "RECIEVED DATA ON STDERR, THIS WILL BREAK YOUR MODULE:" + print "RECIEVED DATA ON STDERR, THIS WILL CRASH YOUR MODULE" print err + sys.exit(1) try: print "***********************************" @@ -84,8 +85,6 @@ print "PARSED OUTPUT" print utils.bigjson(results) -if err and err != '': - sys.exit(1) sys.exit(0) diff --git a/lib/ansible/connection.py b/lib/ansible/connection.py index 02f4a44090c..3f0cf862aa8 100644 --- a/lib/ansible/connection.py +++ b/lib/ansible/connection.py @@ -140,8 +140,7 @@ class ParamikoConnection(object): stderr = chan.makefile_stderr('rb', bufsize) chan.get_pty() chan.set_combine_stderr(False) - - + if not self.runner.sudo or not sudoable: quoted_command = '"$SHELL" -c ' + pipes.quote(cmd) chan.exec_command(quoted_command)