[autotest] Minor bugfixes for host_object_runner.
We need to specify a non-root user and return only the stdout.
I also forgot to update instances->sam_instances from a nit on a
previous CL.
BUG=chromium:340454
TEST=ran on chromeos-mcp
Change-Id: I5bd5b42adc1250c2e7493d9cf3afeef42271e72e
Reviewed-on: https://chromium-review.googlesource.com/187060
Tested-by: Alex Miller <milleral@chromium.org>
Reviewed-by: Dan Shi <dshi@chromium.org>
Commit-Queue: Alex Miller <milleral@chromium.org>
diff --git a/site_utils/lib/infra.py b/site_utils/lib/infra.py
index 571748c..9f4a8a5 100644
--- a/site_utils/lib/infra.py
+++ b/site_utils/lib/infra.py
@@ -36,7 +36,9 @@
try:
host_object = _host_objects[host]
except KeyError:
- host_object = ssh_host.SSHHost(host)
+ username = global_config.global_config.get_config_value(
+ 'CROS', 'infrastructure_user')
+ host_object = ssh_host.SSHHost(host, user=username)
_host_objects[host] = host_object
def runner(cmd):
@@ -49,7 +51,7 @@
@raises CalledProcessError: If there was a non-0 return code.
"""
try:
- return host_object.run(cmd)
+ return host_object.run(cmd).stdout
except error.AutotestHostRunError as e:
exit_status = e.result_obj.exit_status
command = e.result_obj.command
@@ -127,7 +129,7 @@
from the rest of the system.
"""
sams_config = global_config.global_config.get_config_value(
- 'SERVER', 'instances', default='')
+ 'SERVER', 'sam_instances', default='')
sams = _csv_to_list(sams_config)
return sams