labpack: Determine is_labstation by hostname first
BUG=b:211518273
TEST=Local run
Change-Id: I4ef0c5d792804c23eeb3826af257fe164af59f0c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/labpack/+/3453566
Reviewed-by: Otabek Kasimov <otabek@chromium.org>
Commit-Queue: Garry Wang <xianuowang@chromium.org>
Tested-by: Garry Wang <xianuowang@chromium.org>
Auto-Submit: Garry Wang <xianuowang@chromium.org>
Reviewed-by: Otabek Kasimov <otabek@google.com>
diff --git a/server/hosts/base_servohost.py b/server/hosts/base_servohost.py
index 5164d6e..d8027e6 100644
--- a/server/hosts/base_servohost.py
+++ b/server/hosts/base_servohost.py
@@ -156,8 +156,17 @@
return False
if self._is_labstation is None:
- board = self.get_board()
- self._is_labstation = board is not None and 'labstation' in board
+ if 'labstation' in self.hostname:
+ logging.info('Based on hostname, the servohost is'
+ ' a labstation.')
+ self._is_labstation = True
+ else:
+ logging.info(
+ 'Cannot determine if %s is a labstation from'
+ ' hostname, getting board info from the'
+ ' servohost.', self.hostname)
+ board = self.get_board()
+ self._is_labstation = bool(board) and 'labstation' in board
return self._is_labstation