[autotest] Use stable version from afe_stable_versions table
Add a util to get stable version from afe_stable_versions table. If the table
is not configured, return the global config value CROS.stable_cros_version.
Add an RPC get_stable_version(board) to get stable version for given board.
If board is not specified, default stable version will be returned.
Update calls in moblab_RunSuite and cros_host to get stable version through
the new RPC.
BUG=chromium:436656
DEPLOY=apache
CQ-DEPEND=CL:236571
TEST=local rpc test, run repair, confirm repair uses stable version from
afe_stable_versions table.
Change-Id: I6a22a4b471060297403cc1ae7fcbf96bec6563d9
Reviewed-on: https://chromium-review.googlesource.com/236582
Reviewed-by: Dan Shi <dshi@chromium.org>
Commit-Queue: Dan Shi <dshi@chromium.org>
Trybot-Ready: Dan Shi <dshi@chromium.org>
Tested-by: Dan Shi <dshi@chromium.org>
diff --git a/frontend/afe/site_rpc_interface.py b/frontend/afe/site_rpc_interface.py
index 9de362c..c042c3e 100644
--- a/frontend/afe/site_rpc_interface.py
+++ b/frontend/afe/site_rpc_interface.py
@@ -27,6 +27,7 @@
from autotest_lib.server.hosts import moblab_host
from autotest_lib.site_utils import host_history
from autotest_lib.site_utils import job_history
+from autotest_lib.site_utils import stable_version_utils
_CONFIG = global_config.global_config
@@ -455,3 +456,14 @@
shard.labels.clear()
shard.delete()
+
+
+def get_stable_version(board=stable_version_utils.DEFAULT):
+ """Get stable version for the given board.
+
+ @param board: Name of the board.
+ @return: Stable version of the given board. Return global configure value
+ of CROS.stable_cros_version if stable_versinos table does not have
+ entry of board DEFAULT.
+ """
+ return stable_version_utils.get_version(board)
\ No newline at end of file