[autotest] Update provision_AndroidUpdate to use os labels to determine OS.
BUG=None
TEST=locally on moblab
Change-Id: I1506a108890501c79f9afc0fd2eb6da78288ac35
Reviewed-on: https://chromium-review.googlesource.com/356662
Commit-Ready: Simran Basi <sbasi@chromium.org>
Tested-by: Simran Basi <sbasi@chromium.org>
Reviewed-by: Simran Basi <sbasi@chromium.org>
diff --git a/server/afe_utils.py b/server/afe_utils.py
index 21d0767..b713c31 100644
--- a/server/afe_utils.py
+++ b/server/afe_utils.py
@@ -199,3 +199,17 @@
@param prefix: Prefix of label names.
"""
return AFE.get_labels(name__startswith=prefix, host__hostname=host.hostname)
+
+
+def get_os(host):
+ """Retrieve the os for a given host from the AFE.
+
+ Contacts the AFE to retrieve the os for a given host.
+
+ @param host: Host object to get board.
+
+ @returns The os or None if it could not find it.
+ """
+ if not host_in_lab(host):
+ return None
+ return utils.get_label_from_afe(host.hostname, 'os:', AFE)