KVM test: Add flail & systemtap control files
[autotest-zwu.git] / utils / reverify_repair_failed.py
blob4e305ed22f007c6f2a161ba5216e60499c0d4e85
1 #!/usr/bin/python
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)
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 """
11 import optparse, os, sys
13 import common
14 from autotest_lib.server import frontend
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)
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.'
39 if __name__ == '__main__':
40 main()