Fix site_utils reference to utils.
base_utils is the import we are using and where TEE_TO_LOGS exists.
s/utils/base_utils/.
Fix a bug where we reference hosts without ensuring that it is defined.
This happened when testing the above fix.
TEST=./autoserv -m scottz-mario2.cros -c ../client/site_tests/network_Ping/control
BUG=chromium-os:28079
Change-Id: Ic57b96783f143053bfcf7642d867d25734fb9975
Reviewed-on: https://gerrit.chromium.org/gerrit/18535
Reviewed-by: Chris Masone <cmasone@chromium.org>
Commit-Ready: Scott Zawalski <scottz@chromium.org>
Reviewed-by: Scott Zawalski <scottz@chromium.org>
Tested-by: Scott Zawalski <scottz@chromium.org>
diff --git a/client/common_lib/site_utils.py b/client/common_lib/site_utils.py
index ec53150..c8291a4 100644
--- a/client/common_lib/site_utils.py
+++ b/client/common_lib/site_utils.py
@@ -28,5 +28,5 @@
args.append('-c%d' % tries)
return base_utils.run('ping', args=args,
ignore_status=True, timeout=timeout,
- stdout_tee=utils.TEE_TO_LOGS,
- stderr_tee=utils.TEE_TO_LOGS).exit_status
+ stdout_tee=base_utils.TEE_TO_LOGS,
+ stderr_tee=base_utils.TEE_TO_LOGS).exit_status
diff --git a/server/site_autotest.py b/server/site_autotest.py
index 0d1d28e..664f9ff 100755
--- a/server/site_autotest.py
+++ b/server/site_autotest.py
@@ -37,7 +37,7 @@
if self.host:
afe = frontend.AFE(debug=False)
hosts = afe.get_hosts(hostname=self.host.hostname)
- if 'job_repo_url' in hosts[0].attributes:
+ if hosts and 'job_repo_url' in hosts[0].attributes:
return hosts[0].attributes['job_repo_url']
logging.warning("No job_repo_url for %s", self.host)
except ImportError: