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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue