Suppression de quelques fichiers associs aux adhrents.
darcs-hash:20060924202626-68412-b93421a481d14d3707f3e67e2a7ad40994d844f0.gz
This commit is contained in:
parent
831219f78f
commit
a8761b54be
2 changed files with 47 additions and 9 deletions
|
@ -9,6 +9,7 @@ sys.path.append('/usr/scripts/gestion')
|
|||
from affich_tools import cprint, anim, OK, WARNING, ERREUR
|
||||
import config
|
||||
from time import strftime
|
||||
from ldap_crans import hostname
|
||||
|
||||
try:
|
||||
sys.path.append('/usr/lib/mailman')
|
||||
|
@ -27,8 +28,24 @@ class del_user:
|
|||
|
||||
def __init__(self, args):
|
||||
self.args = args
|
||||
|
||||
def reconfigure(self):
|
||||
|
||||
def delete_directory(self, caption, pattern):
|
||||
cprint(caption, "gras")
|
||||
for args in self.args:
|
||||
anim('\t' + args)
|
||||
try:
|
||||
login = args.split(',')[0]
|
||||
d = pattern % login
|
||||
if os.path.isdir(d):
|
||||
shutil.rmtree(d)
|
||||
print OK
|
||||
except:
|
||||
print ERREUR
|
||||
if self.debug:
|
||||
import traceback
|
||||
traceback.print_exc()
|
||||
|
||||
def delete_vert(self):
|
||||
cprint(u'Archivage fichiers utilisateur', 'gras')
|
||||
for args in self.args:
|
||||
anim('\t' + args)
|
||||
|
@ -52,7 +69,6 @@ class del_user:
|
|||
shutil.rmtree('/var/spool/mail/' + login)
|
||||
else:
|
||||
warn += '/var/spool/mail/%s incorrect\n' % login
|
||||
|
||||
if warn:
|
||||
print WARNING
|
||||
if self.debug:
|
||||
|
@ -61,10 +77,20 @@ class del_user:
|
|||
print OK
|
||||
except:
|
||||
print ERREUR
|
||||
if self.debug:
|
||||
if self.debug:
|
||||
import traceback
|
||||
traceback.print_exc()
|
||||
|
||||
def reconfigure(self):
|
||||
if hostname == "vert":
|
||||
self.delete_vert()
|
||||
elif hostname == "rouge":
|
||||
self.delete_directory(u"Suppression des fichiers index de dovecot",
|
||||
"/var/dovecot-indexes/%s")
|
||||
elif hostname == "zamok":
|
||||
self.delete_directory(u"Suppression des fichiers d'impression",
|
||||
"/var/spool/impression/%s")
|
||||
|
||||
class home:
|
||||
debug = True
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ openlog("generate")
|
|||
if os.getuid() != 0:
|
||||
sys.stderr.write("Il faut être root\n")
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
signal.signal(signal.SIGINT, signal.SIG_IGN) # Pas de Ctrl-C
|
||||
|
||||
db = crans_ldap()
|
||||
|
@ -44,9 +44,10 @@ class base_reconfigure:
|
|||
'blacklist_p2p': [ 'sila-blacklist_p2p', 'komaz-blacklist' ],
|
||||
'blacklist_autodisc_upload': [ 'sila-blacklist_autodisc_upload', 'komaz-blacklist'],
|
||||
'blacklist_autodisc_p2p': [ 'sila-blacklist_autodisc_p2p', 'komaz-blacklist'],
|
||||
'blacklist_bloq': [ 'komaz-blacklist', 'sila-blacklist_bloq' ]
|
||||
'blacklist_bloq': [ 'komaz-blacklist', 'sila-blacklist_bloq' ],
|
||||
'del_user': [ 'vert-del_user', 'rouge-del_user', 'zamok-del_user' ]
|
||||
}
|
||||
|
||||
|
||||
def __init__(self, to_do=None):
|
||||
if not to_do:
|
||||
if debug:
|
||||
|
@ -163,9 +164,18 @@ class rouge(base_reconfigure):
|
|||
from gen_confs.surveillance import machines
|
||||
self._do(machines(), self._machines())
|
||||
|
||||
def del_user(self, args):
|
||||
# Suppression des fichiers index de dovecot
|
||||
from adherents import del_user
|
||||
self._do(del_user(args))
|
||||
|
||||
|
||||
class zamok(base_reconfigure):
|
||||
# Tout est dans le parent
|
||||
pass
|
||||
def del_user(self, args):
|
||||
# Suppression des fichies d'impression
|
||||
from adherents import del_user
|
||||
self._do(del_user(args))
|
||||
|
||||
|
||||
class vert(base_reconfigure):
|
||||
def home(self, args):
|
||||
|
@ -173,9 +183,11 @@ class vert(base_reconfigure):
|
|||
self._do(home(args))
|
||||
|
||||
def del_user(self, args):
|
||||
# Suppression du home et des mails
|
||||
from adherents import del_user
|
||||
self._do(del_user(args))
|
||||
|
||||
|
||||
class komaz(base_reconfigure):
|
||||
def __fw(self):
|
||||
if not hasattr(self, '__real_fw'):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue