7 from monitor import database
8 from monitor.database.info.model import *
12 print "blacklist.py --delete=<i>"
17 longopts = ["delete=", "help"]
18 (opts, argv) = getopt.getopt(sys.argv[1:], "d:h", longopts)
19 except getopt.GetoptError, err:
20 print "Error: " + err.msg
23 blacklist = BlacklistRecord.query.all()
24 hostnames = [ h.hostname for h in blacklist ]
26 for (opt, optval) in opts:
27 if opt in ["-d", "--delete"]:
29 bl = BlacklistRecord.get_by(hostname=i)
42 line = sys.stdin.readline()
46 if line not in hostnames:
47 bl = BlacklistRecord(hostname=line)
52 print "Total %d nodes in blacklist" % (i_cnt)
54 if __name__ == '__main__':
58 #except Exception, error:
59 # print "Exception %s" % error