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