Handle missing log directories gracefully
From: Adrian Bauer <adrianbg@google.com>
Signed-off-by: Martin Bligh <mbligh@google.com>
git-svn-id: http://test.kernel.org/svn/autotest/trunk@963 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/server/hosts/ssh_host.py b/server/hosts/ssh_host.py
index de7dd4a..93d1f3d 100644
--- a/server/hosts/ssh_host.py
+++ b/server/hosts/ssh_host.py
@@ -231,6 +231,8 @@
return
if not self.conmux_attach or not os.path.exists(self.conmux_attach):
return
+ assert os.path.isdir(os.path.dirname(logfilename)),\
+ "conmux console log directory doesn't exist. SSHHost(host, conmux_log=None) to disable conmux console logging"
cmd = [self.conmux_attach, self.__conmux_hostname(), 'cat - >> %s' % logfilename]
logger = subprocess.Popen(cmd,
stderr=open('/dev/null', 'w'),
@@ -242,8 +244,10 @@
"""
Log the output of the warning monitor to a specified file
"""
- if logfilename == None or not os.path.isdir('debug'):
+ if logfilename == None:
return
+ assert os.path.isdir(os.path.dirname(logfilename)),\
+ "conmux warning log directory doesn't exist. SSHHost(host, conmux_warnings=None) to disable logging conmux warnings"
script_path = os.path.join(self.serverdir, 'warning_monitor')
script_cmd = 'expect %s %s >> %s' % (script_path,
self.hostname,