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
|
from affich_tools import cprint, anim, OK, WARNING, ERREUR
|
||||||
import config
|
import config
|
||||||
from time import strftime
|
from time import strftime
|
||||||
|
from ldap_crans import hostname
|
||||||
|
|
||||||
try:
|
try:
|
||||||
sys.path.append('/usr/lib/mailman')
|
sys.path.append('/usr/lib/mailman')
|
||||||
|
@ -28,7 +29,23 @@ class del_user:
|
||||||
def __init__(self, args):
|
def __init__(self, args):
|
||||||
self.args = 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')
|
cprint(u'Archivage fichiers utilisateur', 'gras')
|
||||||
for args in self.args:
|
for args in self.args:
|
||||||
anim('\t' + args)
|
anim('\t' + args)
|
||||||
|
@ -52,7 +69,6 @@ class del_user:
|
||||||
shutil.rmtree('/var/spool/mail/' + login)
|
shutil.rmtree('/var/spool/mail/' + login)
|
||||||
else:
|
else:
|
||||||
warn += '/var/spool/mail/%s incorrect\n' % login
|
warn += '/var/spool/mail/%s incorrect\n' % login
|
||||||
|
|
||||||
if warn:
|
if warn:
|
||||||
print WARNING
|
print WARNING
|
||||||
if self.debug:
|
if self.debug:
|
||||||
|
@ -65,6 +81,16 @@ class del_user:
|
||||||
import traceback
|
import traceback
|
||||||
traceback.print_exc()
|
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:
|
class home:
|
||||||
debug = True
|
debug = True
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,8 @@ class base_reconfigure:
|
||||||
'blacklist_p2p': [ 'sila-blacklist_p2p', 'komaz-blacklist' ],
|
'blacklist_p2p': [ 'sila-blacklist_p2p', 'komaz-blacklist' ],
|
||||||
'blacklist_autodisc_upload': [ 'sila-blacklist_autodisc_upload', 'komaz-blacklist'],
|
'blacklist_autodisc_upload': [ 'sila-blacklist_autodisc_upload', 'komaz-blacklist'],
|
||||||
'blacklist_autodisc_p2p': [ 'sila-blacklist_autodisc_p2p', '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):
|
def __init__(self, to_do=None):
|
||||||
|
@ -163,9 +164,18 @@ class rouge(base_reconfigure):
|
||||||
from gen_confs.surveillance import machines
|
from gen_confs.surveillance import machines
|
||||||
self._do(machines(), self._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):
|
class zamok(base_reconfigure):
|
||||||
# Tout est dans le parent
|
def del_user(self, args):
|
||||||
pass
|
# Suppression des fichies d'impression
|
||||||
|
from adherents import del_user
|
||||||
|
self._do(del_user(args))
|
||||||
|
|
||||||
|
|
||||||
class vert(base_reconfigure):
|
class vert(base_reconfigure):
|
||||||
def home(self, args):
|
def home(self, args):
|
||||||
|
@ -173,9 +183,11 @@ class vert(base_reconfigure):
|
||||||
self._do(home(args))
|
self._do(home(args))
|
||||||
|
|
||||||
def del_user(self, args):
|
def del_user(self, args):
|
||||||
|
# Suppression du home et des mails
|
||||||
from adherents import del_user
|
from adherents import del_user
|
||||||
self._do(del_user(args))
|
self._do(del_user(args))
|
||||||
|
|
||||||
|
|
||||||
class komaz(base_reconfigure):
|
class komaz(base_reconfigure):
|
||||||
def __fw(self):
|
def __fw(self):
|
||||||
if not hasattr(self, '__real_fw'):
|
if not hasattr(self, '__real_fw'):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue