[gen_confs/generate] --reconnect programme les reconnexions seulement pour les prochaines 24h

This commit is contained in:
Valentin Samir 2014-02-22 19:01:49 +01:00
parent 7026643353
commit 17199ba900

View file

@ -381,15 +381,17 @@ if __name__ == '__main__':
print 'Recherche des personnes en fin de sanction...'
c = db.search('blacklist=*')
services = []
nom = time()
hier = time() - 24*3600
demain = time() + 24*3600
for a_reco in c['adherent'] + c['machine'] + c['club']:
for bl in a_reco.blacklist():
fin, sanction = bl.split('$')[1:3]
if fin > hier and sanction not in services:
services.append(sanction)
for s in services:
if fin != '-' and fin <= demain and fin >= now and (sanction, fin) not in services:
services.append((sanction, fin))
for s,f in services:
print "Ajout de blacklist_%s pour reconfiguration" % s
db.services_to_restart('blacklist_%s' % s)
db.services_to_restart('blacklist_%s' % s, start=f)
sys.exit(0)
elif opt == '--add':