diff --git a/gestion/gen_confs/generate.py b/gestion/gen_confs/generate.py index 77257056..2032870f 100755 --- a/gestion/gen_confs/generate.py +++ b/gestion/gen_confs/generate.py @@ -43,16 +43,24 @@ class base_reconfigure : def __init__(self,to_do=[]) : if not to_do : if debug : print 'Lecture services à redémarrer dans la base LDAP' - to_do = db.services_to_restart() auto = 1 - # Développements nécessaires - for service,args in to_do.items() : + to_do = {} + # Création de la liste de ce qu'il y a à faire + for serv in db.services_to_restart() : # Services spéciaux portant sur plusieurs machines - to_add = self.__service_develop.get(service,[]) + to_add = self.__service_develop.get(serv.nom,[]) if to_add : - for s in to_add : - db.services_to_restart(s,args) - db.services_to_restart('-' + service) + for nom in to_add : + for t in serv.start : + db.services_to_restart(nom,serv.args,t) + if time() > t : + to_do[nom] = serv.args + db.services_to_restart('-' + serv.nom) + else : + for t in serv.start : + if time() > t : + to_do[serv.nom] = serv.args + break else : auto = 0 if debug : print 'Services à redémarrer imposés (non lecture de la base LDAP)' @@ -79,8 +87,8 @@ class base_reconfigure : reste = db.services_to_restart() if reste : print "Reste à faire :" - for item in reste.items() : - print '\t%s(%s)' % item + for s in reste : + print '\t%s' % s else : print "Plus rien à faire" @@ -131,6 +139,10 @@ class rouge(base_reconfigure) : from gen_confs.switchs import switch self._do(switch(chambres)) + def exemptions(self) : + from exemptions import exemptions + self._do(exemptions()) + class zamok(base_reconfigure) : # Tout est dans le parent pass @@ -161,10 +173,6 @@ class komaz(base_reconfigure) : def blacklist(self) : self.__fw().blacklist() - def exemptions(self) : - from exemptions import exemptions - self._do(exemptions()) - class sila(base_reconfigure) : def bl_carte_etudiant(self) : from gen_confs.squid import squid_carte @@ -276,12 +284,13 @@ if __name__ == '__main__' : elif opt == '--remove' : for serv in val.split('&') : print 'Supression de %s' % serv - db.services_to_restart('-%s' % serv) + db.services_to_restart('--%s' % serv) sys.exit(0) elif opt == '--list' : print 'Services à redémarrer :' - print db.services_to_restart() + for s in db.services_to_restart() : + print '\t%s' % s sys.exit(0) elif opt == '--reconnect' : @@ -310,7 +319,7 @@ if __name__ == '__main__' : arg = [] print 'Ajout de %s (%s)' % ( serv, arg ) - db.services_to_restart(serv, arg) + db.services_to_restart(serv, arg ) sys.exit(0) elif opt =='-h' or opt == '--help' :