• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/usr/bin/python
2
3"""
4Send all Repair Failed hosts that the user running this script has access to
5back into Verifying.  (Only hosts ACL accessable to the user)
6
7Suggested use: Run this as an occasional cron job to re-check if Repair Failed
8hosts have overcome whatever issue caused the failure and are useful again.
9"""
10
11import optparse, os, sys
12
13import common
14from autotest_lib.server import frontend
15
16
17def 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
39if __name__ == '__main__':
40    main()
41