deploy: Check If battery charging during deployment
BUG=b:163572001
TEST=local run
./site_utils/deployment/prepare/main.py --results-dir /tr --hostname chromeos1-row4-rack4-host3 --host-info-file /tr/host_info_store/chromeos1-row4-rack4-host3.store run-pre-deploy-verification
Change-Id: I373dbcf0f8ace2170420a3b3f03c2e4ca4bc61b8
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/autotest/+/2511829
Tested-by: Otabek Kasimov <otabek@google.com>
Reviewed-by: Garry Wang <xianuowang@chromium.org>
Commit-Queue: Otabek Kasimov <otabek@google.com>
diff --git a/site_utils/deployment/prepare/dut.py b/site_utils/deployment/prepare/dut.py
index bf9e122..f548e17 100644
--- a/site_utils/deployment/prepare/dut.py
+++ b/site_utils/deployment/prepare/dut.py
@@ -175,8 +175,12 @@
status = host.run(cmd, timeout=30, ignore_status=True).stdout.strip()
if status not in ['Charging', 'Discharging', 'Full']:
raise Exception(
- 'Unexpected battery status. Please verify that DUT prepared '
- 'for deployment.')
+ 'Unexpected battery status. Please verify that DUT prepared'
+ ' for deployment.')
+ if status in ['Discharging']:
+ raise Exception(
+ 'Unexpected battery status. Please verify that DUT connected'
+ ' to power and charging.')
logging.info("Battery status verification passed!")