[autotest] Clean up get_sample_dut (conservatively)
Caused by https://chromium-review.googlesource.com/#/c/418356/, see
original discussion there.
BUG=None
TEST=None
Change-Id: Id30b7f95d1de6f8bfb453b84aee5a9867b4be441
Reviewed-on: https://chromium-review.googlesource.com/422475
Commit-Ready: Allen Li <ayatane@chromium.org>
Tested-by: Allen Li <ayatane@chromium.org>
Reviewed-by: Prathmesh Prabhu <pprabhu@chromium.org>
diff --git a/frontend/afe/rpc_utils.py b/frontend/afe/rpc_utils.py
index bbac3c4..cd79b88 100644
--- a/frontend/afe/rpc_utils.py
+++ b/frontend/afe/rpc_utils.py
@@ -1390,10 +1390,14 @@
"""
if not (dev_server.PREFER_LOCAL_DEVSERVER and pool and board):
return None
-
- hosts = get_host_query(
- ('pool:%s' % pool, 'board:%s' % board), False, False, True, {})
+ hosts = list(get_host_query(
+ multiple_labels=('pool:%s' % pool, 'board:%s' % board),
+ exclude_only_if_needed_labels=False,
+ exclude_atomic_group_hosts=False,
+ valid_only=True,
+ filter_data={},
+ ))
if not hosts:
return None
-
- return list(hosts)[0].get_object_dict()['hostname']
+ else:
+ return hosts[0].get_object_dict()['hostname']