diff options
author | jadmanski <jadmanski@592f7852-d20e-0410-864c-8624ca9c26a4> | 2009-05-21 22:23:02 +0000 |
---|---|---|
committer | jadmanski <jadmanski@592f7852-d20e-0410-864c-8624ca9c26a4> | 2009-05-21 22:23:02 +0000 |
commit | 65ae0011a07999aede38f2b795ec8380e74dd589 (patch) | |
tree | 0cd4ef196c232d76181ba1e00834189dfc5eefdf /server | |
parent | e753f6f4bcfce672c1789b3ccb7184b390368ac2 (diff) |
Clean up _get_autodir in autotest.py a bit. Adds in some more logging
to make it easier to see what decisions it's making, and changes
the final fallback to checking /usr/local/autotest and /home/autotest
to just look for the directories, rather than an installed client.
Only checking for existing clients at those locations is inconsistent
with the other checks this call does.
Risk: Medium
Visibility: Adds logging to autotest._get_autodir and adjusts its
search to be more consistent.
Signed-off-by: John Admanski <jadmanski@google.com>
git-svn-id: svn://test.kernel.org/autotest/trunk@3166 592f7852-d20e-0410-864c-8624ca9c26a4
Diffstat (limited to 'server')
-rw-r--r-- | server/autotest.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/server/autotest.py b/server/autotest.py index bf8f90d7..3f4e5fb4 100644 --- a/server/autotest.py +++ b/server/autotest.py @@ -679,23 +679,26 @@ class _Run(object): def _get_autodir(host): autodir = host.get_autodir() if autodir: + logging.debug('Using existing host autodir: %s', autodir) return autodir try: # There's no clean way to do this. readlink may not exist - cmd = "python -c 'import os,sys; print os.readlink(sys.argv[1])' /etc/autotest.conf 2> /dev/null" + cmd = ("python -c '%s' /etc/autotest.conf 2> /dev/null" + % "import os,sys; print os.readlink(sys.argv[1])") autodir = os.path.dirname(host.run(cmd).stdout) if autodir: + logging.debug('Using autodir from /etc/autotest.conf: %s', autodir) return autodir except error.AutoservRunError: pass for path in ['/usr/local/autotest', '/home/autotest']: try: - host.run('ls %s > /dev/null 2>&1' % - os.path.join(path, 'bin/autotest')) + host.run('ls %s > /dev/null 2>&1' % path) + logging.debug('Found autodir at %s', path) return path except error.AutoservRunError: - pass - raise error.AutotestRunError("Cannot figure out autotest directory") + logging.debug('%s does not exist', path) + raise error.AutotestRunError('Cannot figure out autotest directory') class log_collector(object): |