Service redmarrer temporis pour les blacklists.
darcs-hash:20051002191118-41617-8897f3cdbb75d0ebbcdd70df63b748421cce9019.gz
This commit is contained in:
parent
78d5ac0e36
commit
da9b6f7900
1 changed files with 24 additions and 8 deletions
|
@ -810,16 +810,23 @@ class base_classes_crans(crans_ldap) :
|
|||
# Verif que les dates sont OK
|
||||
if new[0] == 'now' :
|
||||
new[0] = time.strftime(date_format)
|
||||
debut=0
|
||||
else :
|
||||
try : time.strptime(new[0],date_format)
|
||||
try : debut=int(time.mktime(time.strptime(new[0],date_format)))
|
||||
except : raise ValueError(u'Date de début blacklist invalide')
|
||||
|
||||
if new[1] == 'now' :
|
||||
if new[1] == 'now' :
|
||||
new[1] = time.strftime(date_format)
|
||||
elif new[1]!='-' :
|
||||
try : time.strptime(new[1],date_format)
|
||||
fin=0
|
||||
elif new[1]!='-' :
|
||||
try : fin=int(time.mktime(time.strptime(new[1],date_format)))
|
||||
except : raise ValueError(u'Date de fin blacklist invalide')
|
||||
else :
|
||||
fin = -1
|
||||
|
||||
if debut == fin :
|
||||
raise ValueError(u'Dates de début et fin identiques')
|
||||
|
||||
new_c = ','.join(new)
|
||||
new_c = preattr(new_c)[1]
|
||||
|
||||
|
@ -831,7 +838,16 @@ class base_classes_crans(crans_ldap) :
|
|||
if self._data['blacklist'] != liste :
|
||||
self._data['blacklist']=liste
|
||||
self.modifs.append('blacklist_' + new[2])
|
||||
|
||||
if not hasattr(self,"__blacklist_restart") :
|
||||
self.__blacklist_restart={}
|
||||
if self.__blacklist_restart.has_key(new[2]) :
|
||||
self.__blacklist_restart[new[2]] = [ debut, fin ]
|
||||
else :
|
||||
if debut not in self.__blacklist_restart[new[2]] :
|
||||
self.__blacklist_restart[new[2]].Append(debut)
|
||||
if fin!=-1 and fin not in self.__blacklist_restart[new[2]] :
|
||||
self.__blacklist_restart[new[2]].Append(fin)
|
||||
|
||||
return liste
|
||||
|
||||
def restore(self) :
|
||||
|
@ -977,9 +993,9 @@ class base_classes_crans(crans_ldap) :
|
|||
|
||||
### Génération de la liste de services à redémarrer
|
||||
# Quasiement tout est traité dans les classes filles.
|
||||
for m in self.modifs :
|
||||
if sre.match('blacklist_*',m) :
|
||||
self.services_to_restart(m)
|
||||
if hasattr(self,"__blacklist_restart") :
|
||||
for n,t in self.__blacklist_restart.items() :
|
||||
self.services_to_restart("blacklist_%s"%n,[],t)
|
||||
|
||||
# Reinitialisation
|
||||
self._init_data = self._data.copy()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue