git://git.onelab.eu
/
monitor.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
properties and emailTxt
[monitor.git]
/
mailmonitor.py
diff --git
a/mailmonitor.py
b/mailmonitor.py
index
8481966
..
fab3e65
100644
(file)
--- a/
mailmonitor.py
+++ b/
mailmonitor.py
@@
-6,15
+6,15
@@
#
# $Id: monitor.py,v 1.7 2007/07/03 19:59:02 soltesz Exp $
#
# $Id: monitor.py,v 1.7 2007/07/03 19:59:02 soltesz Exp $
-import database
-
-import rt
import sys
import sys
-import plc
-api = plc.getAuthAPI()
-
+from monitor import database
+from monitor.wrapper import rt
+from monitor.wrapper import plc
from monitor.policy import *
from monitor.policy import *
+from monitor.database.info.model import *
+
+api = plc.getAuthAPI()
def reboot(hostname):
print "CALLING: mailmonitor.reboot(%s)" % hostname
def reboot(hostname):
print "CALLING: mailmonitor.reboot(%s)" % hostname
@@
-23,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)