remove old blacklist
authorStephen Soltesz <soltesz@cs.princeton.edu>
Wed, 1 Apr 2009 20:04:42 +0000 (20:04 +0000)
committerStephen Soltesz <soltesz@cs.princeton.edu>
Wed, 1 Apr 2009 20:04:42 +0000 (20:04 +0000)
add policy execution to automate-default.sh

automate-default.sh
bootman.py
get_metasite_nodes.py
grouprins.py
mailmonitor.py

index 6a948a5..8d67c94 100755 (executable)
@@ -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 || :
 
 # 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.
 echo "Archiving pkl files"
 #########################
 # Archive pkl files.
index a43a95b..cfc47a1 100755 (executable)
@@ -651,7 +651,6 @@ def restore(sitehist, hostname, config=None, forced_action=None):
                return True
 
        # Read persistent flags, tagged on one week intervals.
                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()
 
        if config and not config.quiet: print "...downloading dmesg from %s" %hostname 
        dmesg = conn.get_dmesg()
index 7fb46ef..e2d5764 100755 (executable)
@@ -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"]
 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
        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)
 
        print "Found %d nodes" % count
        print "Found %d sites " % len(l_sitelist)
 
-       database.dbDump("l_blacklist")
 
 if __name__=="__main__":
        main() 
 
 if __name__=="__main__":
        main() 
index eb89e6a..5529418 100755 (executable)
@@ -18,6 +18,7 @@ from monitor import const
 from monitor import database
 from monitor import parser as parsermodule
 from monitor import reboot
 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()
 
 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?
 
        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
 # commands:
 i = 1
 count = 1
index 8af368a..fab3e65 100644 (file)
@@ -12,6 +12,7 @@ from monitor import database
 from monitor.wrapper import rt
 from monitor.wrapper import plc
 from monitor.policy import *
 from monitor.wrapper import rt
 from monitor.wrapper import plc
 from monitor.policy import *
+from monitor.database.info.model import *
 
 api = plc.getAuthAPI()
 
 
 api = plc.getAuthAPI()
 
@@ -22,9 +23,9 @@ def reboot(hostname):
        if len(l_nodes) == 0:
                raise Exception("No such host: %s" % 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)
        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)