1 #!/usr/bin/python 2 # 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 8 import sys 9 10 import common 11 12 from 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 27 if len(sys.argv) >= 2: 28 frontend.AFE().repair_hosts(hostnames=sys.argv[1:]) 29