[gen_confs/squid.py] On passage à squid3

darcs-hash:20090603171843-bd074-7f0d1fd6219968d70b1a5af31da16d33010f2dba.gz
This commit is contained in:
Antoine Durand-Gasselin 2009-06-03 19:18:43 +02:00
parent ecb713cc85
commit 9aaaae7e6a

View file

@ -13,14 +13,14 @@ from config import bl_carte_et_actif
class squid(gen_config) :
db = crans_ldap()
actif = True # la sanction est elle active ?
restart_cmd = '/etc/init.d/squid reload'
restart_cmd = '/etc/init.d/squid3 reload'
def __str__(self) :
return str(self.__class__).replace('_','-').split('.')[2]
def _gen(self) :
self._mklist()
def _mklist(self) :
fic = self._open_conf(self.FICHIER)
@ -32,15 +32,15 @@ class squid(gen_config) :
# chaine de tri spéciale
liste = self.db.search("paiement=ok&%s"%self.chaine)
l_proprio = liste["adherent"] + liste["club"]
l_machine = liste["machine"]
l_machine = liste["machine"]
else:
# recherche dans les adhérents blacklistés
liste = self.db.search("paiement=ok&ablacklist=*%s*"%self.chaine)
l_proprio = liste["adherent"] + liste["club"]
l_proprio = [ x for x in l_proprio if self.chaine in x.blacklist_actif() ]
# recherche dans les machines blacklistés
# recherche dans les machines blacklistés
liste = self.db.search("paiement=ok&mblacklist=*%s*"%self.chaine)
l_machine = liste["machine"]
l_machine = [ m for m in l_machine if self.chaine in m.blacklist_actif() ]
@ -48,11 +48,11 @@ class squid(gen_config) :
# on ajoute les machines des proprios aux autres machines
for proprio in l_proprio :
l_machine += proprio.machines()
# on colle toutes les machines dans le fichier
self.anim.iter=len(l_machine)
for m in l_machine:
self.anim.cycle()
self.anim.cycle()
fic.write( m.Nom() + '\n' )
fic.close()
@ -80,7 +80,7 @@ class squid_virus(squid) :
""" Genère le fichier blacklist-virus pour squid """
FICHIER = "/etc/squid/blacklist_virus"
chaine = "virus"
class squid_warez(squid) :
""" Genère le fichier blacklist-warez pour squid """
FICHIER = "/etc/squid/blacklist_warez"
@ -90,7 +90,7 @@ class squid_bloq(squid) :
""" Genère le fichier blacklist-bloq pour squid """
FICHIER = "/etc/squid/blacklist_bloq"
chaine = "bloq"
class squid_carte(squid) :
""" Genère le fichier blacklist-carte pour squid """
actif = bl_carte_et_actif