Consquences de la possibilit de mettre des dates de restart.

darcs-hash:20051001225512-41617-b2840fa818496a89130cf0b72e654ee213d32071.gz
This commit is contained in:
pauget 2005-10-02 00:55:12 +02:00
parent 201e09064a
commit fcfb66cadf

View file

@ -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' :