blob: e7dd435f531214acc1f790d7f311e29488ada027 [file] [log] [blame]
Mike Frysingerd03e6b52019-08-03 12:49:01 -04001#!/usr/bin/python2
Richard Barnette73e74b02017-08-10 15:16:49 -07002# Simple utility to trigger a Repair job on a bunch of hosts.
3#
4# CAVEAT: no error checking; if any argument isn't a valid
5# host, it will be silently ignored. If there are no command
6# line arguments, silently succeed.
7
8import sys
9
10import common
11
12from autotest_lib.server import frontend
13
14# For simplicity, we want to do nothing if there are no hosts named
15# on the command line. That makes it easy to do stuff like this:
16# dut-status -b $BOARD -p bvt -n | xargs repair_hosts
17#
18# By doing nothing, we get more useful behavior if all the DUTs selected
19# by `dut-status` are actually working.
20#
21# Note that we have to specifically test for an empty host list: I
22# _think_ (but I don't know) that the AFE calls operate on all the
23# hosts if there are no arguments given. I do know for certain that
24# with hostnames=[], the call takes longer than I was willing to
25# wait.
26
27if len(sys.argv) >= 2:
28 frontend.AFE().repair_hosts(hostnames=sys.argv[1:])