[autotest] Support adb_host repair

Implements a basic repair function for adb_host which
runs provision_AndroidUpdate if the device is reachable
via fastboot. The repair image will be retrieved from
global_config or the DB if it is set.

BUG=b:26879108
TEST=local moblab repair.

Change-Id: I26a962c1bf458a8b02ad66efbc2c2bda99530320
Reviewed-on: https://chromium-review.googlesource.com/325519
Commit-Ready: Simran Basi <[email protected]>
Tested-by: Simran Basi <[email protected]>
Reviewed-by: Kevin Cheng <[email protected]>
diff --git a/site_utils/stable_version_utils.py b/site_utils/stable_version_utils.py
index 6452be1..0477c34 100644
--- a/site_utils/stable_version_utils.py
+++ b/site_utils/stable_version_utils.py
@@ -35,21 +35,31 @@
     return versions
 
 
-def get(board=DEFAULT):
+def get(board=DEFAULT, android=False):
     """Get stable version for the given board.
 
     @param board: Name of the board, default to value `DEFAULT`.
+    @param android: If True, indicates we are looking up a Android/Brillo-based
+                    board. There is no default version that works for all
+                    Android/Brillo boards. If False, we are looking up a Chrome
+                    OS based board.
+
     @return: Stable version of the given board. If the given board is not listed
              in afe_stable_versions table, DEFAULT will be used.
              Return global_config value of CROS.stable_cros_version if
              afe_stable_versions table does not have entry of board DEFAULT.
     """
+    if board == DEFAULT and android:
+        return None
     try:
         return models.StableVersion.objects.get(board=board).version
     except django.core.exceptions.ObjectDoesNotExist:
         if board == DEFAULT:
             return global_config.global_config.get_config_value(
                     'CROS', 'stable_cros_version')
+        elif android:
+            return global_config.global_config.get_config_value(
+                    'ANDROID', 'stable_version_%s' % board, default=None)
         else:
             return get(board=DEFAULT)