Mise en forme.
darcs-hash:20060406030222-68412-0dbc2a0cc3d34c3e5de5ee2607f35ad0a5cf3fd7.gz
This commit is contained in:
parent
8d76992b10
commit
cd8bafd791
1 changed files with 26 additions and 20 deletions
|
@ -11,9 +11,13 @@ import config
|
|||
from time import strftime
|
||||
|
||||
class del_user:
|
||||
""" Suppression des fichiers d'un compte utilisateur """
|
||||
|
||||
debug = True
|
||||
|
||||
def __init__(self,args):
|
||||
self.args = args
|
||||
|
||||
def reconfigure(self):
|
||||
cprint(u'Archivage fichiers utilisateur', 'gras')
|
||||
for args in self.args:
|
||||
|
@ -23,7 +27,9 @@ class del_user :
|
|||
if not login or not home:
|
||||
raise ValueError('Argument invalide')
|
||||
warn = ''
|
||||
f = config.cimetiere + '/files/' + strftime('%Y-%m-%d-%Hh%Mm_') + login + '.tar.bz2'
|
||||
f = '%s/files/%s_%s.tar.bz2' % (config.cimetiere,
|
||||
strftime('%Y-%m-%d-%Hh%Mm'),
|
||||
login)
|
||||
status, output = commands.getstatusoutput("tar cjf '%s' '%s' /var/spool/mail/%s" % (f, home, login))
|
||||
if (status != 512 and status != 0) or not os.path.isfile(f):
|
||||
# La 512 est si un des paths n'exite pas.
|
||||
|
@ -65,11 +71,11 @@ class home:
|
|||
os.mkdir(home, 0755)
|
||||
os.chown(home, int(uid) ,config.gid)
|
||||
elif os.path.isdir(home) :
|
||||
# Il y un r-bépertoire existant-A
|
||||
# Il y un répertoire existant
|
||||
# Bon UID ?
|
||||
stat = os.stat(home)
|
||||
if stat[4] != int(uid) or stat[5] != config.gid :
|
||||
# Le home n'est pas -bà la bonne personne-A
|
||||
# Le home n'est pas à la bonne personne
|
||||
raise OSError('home existant')
|
||||
|
||||
### Quota
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue