From 17199ba9007e35882d256d97833ae243996e1ab7 Mon Sep 17 00:00:00 2001 From: Valentin Samir Date: Sat, 22 Feb 2014 19:01:49 +0100 Subject: [PATCH] [gen_confs/generate] --reconnect programme les reconnexions seulement pour les prochaines 24h --- gestion/gen_confs/generate.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/gestion/gen_confs/generate.py b/gestion/gen_confs/generate.py index 03f47709..c2fb4f69 100755 --- a/gestion/gen_confs/generate.py +++ b/gestion/gen_confs/generate.py @@ -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':