From 7e40adbaba76448e54044893e7e49e8c224e86d0 Mon Sep 17 00:00:00 2001 From: John Eckersberg Date: Tue, 22 Jan 2008 16:53:42 -0500 Subject: check return code on SSH to determine error or not --- func/minion/modules/netapp/common.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/func/minion/modules/netapp/common.py b/func/minion/modules/netapp/common.py index ab63cbc..d041336 100644 --- a/func/minion/modules/netapp/common.py +++ b/func/minion/modules/netapp/common.py @@ -2,7 +2,9 @@ import subprocess SSH = '/usr/bin/ssh' -class GenericSSHException(Exception): pass +class GenericSSHError(Exception): pass +class NetappCommandError(Exception): pass +class NetappNotImplementedError(Exception): pass def ssh(user, host, command): cmd = subprocess.Popen([SSH, "%s@%s" % (user, host), command], @@ -13,8 +15,7 @@ def ssh(user, host, command): shell=False) (out, err) = cmd.communicate() - - if err: - raise GenericSSHException, err + if cmd.wait() != 0: + raise GenericSSHError, err else: return out -- cgit