X-Git-Url: http://git.onelab.eu/?p=monitor.git;a=blobdiff_plain;f=commands%2Fblacklist.py;fp=blacklist.py;h=3ff769f0e4f9caa28445bea32e6ce91b668f5952;hp=34745c830ffe2ff84c79f5517684436455e4a167;hb=e637272100e8e03884188cb2118b21158e739bb0;hpb=328ee7b92f4e23570d8a33ad9244413ae3aee6bf diff --git a/blacklist.py b/commands/blacklist.py similarity index 87% rename from blacklist.py rename to commands/blacklist.py index 34745c8..3ff769f 100755 --- a/blacklist.py +++ b/commands/blacklist.py @@ -43,9 +43,8 @@ def main(): loginbases_q = BlacklistRecord.getLoginbaseBlacklist() hostnames = [ h.hostname for h in hostnames_q ] loginbases = [ h.loginbase for h in loginbases_q ] - hostnames_exp = [ (h.hostname,h.date_created+timedelta(0,h.expires),h.date_created+timedelta(0,h.expires) < datetime.now() and h.expires != 0) for h in hostnames_q ] - #loginbases_exp = [ (h.loginbase,h.date_created+timedelta(0,h.expires)) for h in loginbases_q ] - loginbases_exp = [ (h.loginbase,h.date_created+timedelta(0,h.expires),h.date_created+timedelta(0,h.expires) < datetime.now() and h.expires != 0) for h in loginbases_q ] + hostnames_exp = [ (h.hostname,h.date_created+timedelta(0,h.expires)) for h in hostnames_q ] + loginbases_exp = [ (h.loginbase,h.date_created+timedelta(0,h.expires)) for h in loginbases_q ] if config.add: print "Blacklisting nodes: ", l_nodes @@ -79,9 +78,7 @@ def main(): objlist = hostnames_exp for i in objlist: - if i[2]: - print i[0], i[1], "<-- expired" - elif i[1] > datetime.now(): + if i[1] > datetime.now(): print i[0], i[1] else: print i[0]