mbligh | 4e545a5 | 2009-12-19 05:30:39 +0000 | [diff] [blame] | 1 | #!/usr/bin/python |
| 2 | |
| 3 | """ |
| 4 | Send all Repair Failed hosts that the user running this script has access to |
| 5 | back into Verifying. (Only hosts ACL accessable to the user) |
| 6 | |
| 7 | Suggested use: Run this as an occasional cron job to re-check if Repair Failed |
| 8 | hosts have overcome whatever issue caused the failure and are useful again. |
| 9 | """ |
| 10 | |
| 11 | import optparse, os, sys |
| 12 | |
| 13 | import common |
| 14 | from autotest_lib.server import frontend |
| 15 | |
| 16 | |
| 17 | def main(): |
| 18 | parser = optparse.OptionParser(usage='%prog [options]\n\n' + |
| 19 | __doc__.strip()) |
| 20 | parser.add_option('-w', dest='server', default='autotest', |
| 21 | help='Hostname of the autotest frontend RPC server.') |
| 22 | parser.add_option('-b', dest='label', default=None, type=str, |
| 23 | help='A label to restrict the set of hosts reverified.') |
| 24 | options, unused_args = parser.parse_args(sys.argv) |
| 25 | |
| 26 | afe_client = frontend.AFE(debug=False, server=options.server) |
| 27 | hostnames = afe_client.reverify_hosts(status='Repair Failed', |
| 28 | label=options.label) |
| 29 | # The old RPC interface didn't return anything. |
| 30 | # A more recent one returns a list of hostnames to make this message useful. |
| 31 | if hostnames: |
| 32 | print 'The following Repair Failed hosts on', options.server, |
| 33 | print 'will be reverified:' |
| 34 | print ' '.join(hostnames) |
| 35 | else: |
| 36 | print 'Repair Failed hosts on', options.server, 'will be reverified.' |
| 37 | |
| 38 | |
| 39 | if __name__ == '__main__': |
| 40 | main() |