From bccd163b2e37f39e2b067b619d26935300ae882b Mon Sep 17 00:00:00 2001 From: Stephen Soltesz Date: Wed, 1 Apr 2009 20:04:42 +0000 Subject: [PATCH] remove old blacklist add policy execution to automate-default.sh --- automate-default.sh | 2 ++ bootman.py | 1 - get_metasite_nodes.py | 2 -- grouprins.py | 4 +++- mailmonitor.py | 5 +++-- 5 files changed, 8 insertions(+), 6 deletions(-) diff --git a/automate-default.sh b/automate-default.sh index 6a948a5..8d67c94 100755 --- a/automate-default.sh +++ b/automate-default.sh @@ -69,6 +69,8 @@ ps ax | grep BatchMode | grep -v grep | awk '{print $1}' | xargs -r kill || : # clean up stray 'locfg' processes that hang around inappropriately... ps ax | grep locfg | grep -v grep | awk '{print $1}' | xargs -r kill || : +${MONITOR_SCRIPT_ROOT}/policy.py $DATE + echo "Archiving pkl files" ######################### # Archive pkl files. diff --git a/bootman.py b/bootman.py index a43a95b..cfc47a1 100755 --- a/bootman.py +++ b/bootman.py @@ -651,7 +651,6 @@ def restore(sitehist, hostname, config=None, forced_action=None): return True # Read persistent flags, tagged on one week intervals. - #pflags = PersistFlags(hostname, 3*60*60*24, db='debug_persistflags') if config and not config.quiet: print "...downloading dmesg from %s" %hostname dmesg = conn.get_dmesg() diff --git a/get_metasite_nodes.py b/get_metasite_nodes.py index 7fb46ef..e2d5764 100755 --- a/get_metasite_nodes.py +++ b/get_metasite_nodes.py @@ -7,7 +7,6 @@ import sys def main(): meta_sites = ['canarie', 'rnp', 'jgn2', 'i2', 'tp', 'princeton', 'princetondsl', 'plcolo', 'wide'] l_blacklist = [ "grouse.hpl.hp.com", "planet1.att.nodes.planet-lab.org"] - #l_blacklist = database.dbLoad("l_blacklist") l_sitelist = [] count = 0 # for each prefix above @@ -33,7 +32,6 @@ def main(): print "Found %d nodes" % count print "Found %d sites " % len(l_sitelist) - database.dbDump("l_blacklist") if __name__=="__main__": main() diff --git a/grouprins.py b/grouprins.py index eb89e6a..5529418 100755 --- a/grouprins.py +++ b/grouprins.py @@ -18,6 +18,7 @@ from monitor import const from monitor import database from monitor import parser as parsermodule from monitor import reboot +from monitor.database.info.model import * from monitor.wrapper import plc api = plc.getAuthAPI() @@ -251,7 +252,8 @@ if config.findbad: os.system("./findbad.py --cachenodes --increment --nodelist %s" % file) # TODO: shouldn't we reload the node list now? -l_blacklist = database.if_cached_else(1, "l_blacklist", lambda : []) +q_blacklist = BlacklistRecord.query.all() +l_blacklist = [ n.hostname for n in q_blacklist ] # commands: i = 1 count = 1 diff --git a/mailmonitor.py b/mailmonitor.py index 8af368a..fab3e65 100644 --- a/mailmonitor.py +++ b/mailmonitor.py @@ -12,6 +12,7 @@ from monitor import database from monitor.wrapper import rt from monitor.wrapper import plc from monitor.policy import * +from monitor.database.info.model import * api = plc.getAuthAPI() @@ -22,9 +23,9 @@ def reboot(hostname): if len(l_nodes) == 0: raise Exception("No such host: %s" % hostname) - l_blacklist = database.if_cached_else(1, "l_blacklist", lambda : []) - l_ticket_blacklist = database.if_cached_else(1,"l_ticket_blacklist",lambda : []) + q_blacklist = BlacklistRecord.query.all() + l_blacklist = [ n.hostname for n in q_blacklist ] l_nodes = filter(lambda x : not x['hostname'] in l_blacklist, l_nodes) if len(l_nodes) == 0: raise Exception("Host removed via blacklist: %s" % hostname) -- 2.43.0