diff options
| author | Tim <timothyasir@gluster.com> | 2011-08-09 17:32:29 +0530 |
|---|---|---|
| committer | Tim <timothyasir@gluster.com> | 2011-08-09 17:32:29 +0530 |
| commit | 4d5151cceea8d9c1472d235994c2938687f3c869 (patch) | |
| tree | 48d13e09d8e74c56262a0dfb477fc5afe8480aea /src/com.gluster.storage.management.gateway/WebContent/scripts/grun.py | |
| parent | 98bd352e70af80f103e4b2f00848bb612bc72504 (diff) | |
Enhanced error handling and written appropriate execution error into stderr.
Diffstat (limited to 'src/com.gluster.storage.management.gateway/WebContent/scripts/grun.py')
| -rwxr-xr-x | src/com.gluster.storage.management.gateway/WebContent/scripts/grun.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/com.gluster.storage.management.gateway/WebContent/scripts/grun.py b/src/com.gluster.storage.management.gateway/WebContent/scripts/grun.py index e09ef5bc..cc00f466 100755 --- a/src/com.gluster.storage.management.gateway/WebContent/scripts/grun.py +++ b/src/com.gluster.storage.management.gateway/WebContent/scripts/grun.py @@ -33,13 +33,15 @@ def main(): fp.close() except IOError, e: Utils.log("Failed to read server file %s: %s\n" % (serverFile, str(e))) + sys.stderr.write("Failed to read server file %s: %s\n" % (serverFile, str(e))) sys.exit(1) status = True for serverName in serverNameList: - rv = Utils.runCommand(sshCommandPrefix + [serverName.strip()] + command) - print "%s: %s" % (serverName, rv) - if rv != 0: + rv = Utils.runCommand(sshCommandPrefix + [serverName.strip()] + command, output=True) + if rv["Status"] != 0: + sys.stderr.write("%s: %s\nStdout:\n%s\nStderr:%s\n---\n" \ + % (serverName, rv["Status"], rv["Stdout"], rv["Stderr"])) status = False if status: |
