Fixes SSHHost.__del__ to make sure that the "logger_pid" and "netlogger_pid"
attributes exist before using them. If something bad happens during __init__
it's possible that the attributes might not be initialized yet.
From: jadmanski@google.com
Signed-off-by: Martin J. Bligh <mbligh@google.com>
git-svn-id: http://test.kernel.org/svn/autotest/trunk@818 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/server/hosts/ssh_host.py b/server/hosts/ssh_host.py
index ee93fac..1a0b1b8 100644
--- a/server/hosts/ssh_host.py
+++ b/server/hosts/ssh_host.py
@@ -89,14 +89,14 @@
except errors.AutoservRunError:
pass
# kill the console logger
- if self.logger_pid:
+ if getattr(self, 'logger_pid', None):
try:
pgid = os.getpgid(self.logger_pid)
os.killpg(pgid, signal.SIGTERM)
except OSError:
pass
# kill the netconsole logger
- if self.netlogger_pid:
+ if getattr(self, 'netlogger_pid', None):
try:
os.kill(self.netlogger_pid, signal.SIGTERM)
except OSError: