[autotest] Update Repair and Verify to handle a testbed.
The repair and verify flow assumes the machine passed in is a host.
Both control segments now check to see if it's dealing with a testbed
and to run through a list of hosts and run the proper host methods to
ensure a successful verify/repair.
BUG=chromium:548739
TEST=Locally ran reverify/repair on testbed with shamu/angler/hammerhead
successfully.
Change-Id: Ib0ade22dd9e3d7496c083fe48b642ed4069eadd6
Reviewed-on: https://chromium-review.googlesource.com/318385
Commit-Ready: Kevin Cheng <kevcheng@chromium.org>
Tested-by: Kevin Cheng <kevcheng@chromium.org>
Reviewed-by: Richard Barnette <jrbarnette@chromium.org>
Reviewed-by: Simran Basi <sbasi@chromium.org>
diff --git a/server/site_utils.py b/server/site_utils.py
index 52ab791..623c92e 100644
--- a/server/site_utils.py
+++ b/server/site_utils.py
@@ -718,3 +718,19 @@
if not creds_dir or not os.path.exists(creds_dir):
creds_dir = common.autotest_dir
return os.path.join(creds_dir, creds_file)
+
+
+def machine_is_testbed(machine):
+ """Checks if the machine is a testbed.
+
+ The signal we use to determine if the machine is a testbed
+ is if the host attributes contain more than 1 serial.
+
+ @param machine: is a list of dicts
+
+ @return: True if the machine is a testbed, False otherwise.
+ """
+ _, attributes = get_host_info_from_machine(machine)
+ if len(attributes.get('serials', '').split(',')) > 1:
+ return True
+ return False