- os.path.dirname(os.path.realpath('/etc/autotest.conf'))
will never throw exception, and thus always assumed, that
homedir is /etc -> use os.path.isfile() instead
- os.path.join() absolute path fixed to relative
- if autotest home can not be found, print message and exit

Signed-off-by: Jan Stancek <[email protected]>
---
 client/tools/autotest |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/client/tools/autotest b/client/tools/autotest
index 42f6238..8fae3f4 100755
--- a/client/tools/autotest
+++ b/client/tools/autotest
@@ -2,15 +2,19 @@
 import sys,os
 
 autodir = None
-try:
-    autodir = os.path.dirname(os.path.realpath('/etc/autotest.conf'))
-except:
-    pass
+autotest_conf = os.path.realpath('/etc/autotest.conf')
+
+if os.path.isfile(autotest_conf):
+    autodir = os.path.dirname(autotest_conf)
 if not autodir:
     for path in ['/usr/local/autotest', '/home/autotest']:
-        if os.path.exists(os.path.join(path, '/bin/autotest')):
+        if os.path.exists(os.path.join(path, 'bin/autotest')):
             autodir = path
 
+if not autodir:
+    print "Autotest home dir NOT FOUND"
+    sys.exit()
+
 autotest = os.path.join(autodir, 'bin/autotest')
 control = os.path.join(autodir, 'control')
 state = os.path.join(autodir, 'control.state')
-- 
1.7.1
_______________________________________________
Autotest mailing list
[email protected]
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest

Reply via email to