fedora-accounts process-shell-accounts.py,1.3,1.4
Michael Patrick McGrath (mmcgrath)
fedora-extras-commits at redhat.com
Sun Aug 5 20:24:25 UTC 2007
Author: mmcgrath
Update of /cvs/fedora/fedora-accounts
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv25027
Modified Files:
process-shell-accounts.py
Log Message:
check to make sure dirs need to be removed, before removing them
Index: process-shell-accounts.py
===================================================================
RCS file: /cvs/fedora/fedora-accounts/process-shell-accounts.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- process-shell-accounts.py 3 Aug 2007 22:23:58 -0000 1.3
+++ process-shell-accounts.py 5 Aug 2007 20:24:23 -0000 1.4
@@ -72,18 +72,19 @@
# Backup and delete home directories
homedirs = ' '.join(del_homedir)
-backupFile = tempfile.mkstemp(suffix='.tar.gz', prefix='deleted_home_dirs.',
- dir='/tmp/')
-backupCmd = os.popen('tar -czf - ' + homedirs, 'r')
-chunk = backupCmd.read(4096)
-while chunk:
- os.write(backupFile[0], chunk)
+if homedirs:
+ backupFile = tempfile.mkstemp(suffix='.tar.gz', prefix='deleted_home_dirs.',
+ dir='/tmp/')
+ backupCmd = os.popen('tar -czf - ' + homedirs, 'r')
chunk = backupCmd.read(4096)
-os.close(backupFile[0])
-backupCmd.close()
-print 'directories saved in %s' % backupFile[1]
-os.system("rm -rvf " + homedirs)
-
+ while chunk:
+ os.write(backupFile[0], chunk)
+ chunk = backupCmd.read(4096)
+ os.close(backupFile[0])
+ backupCmd.close()
+ print 'directories saved in %s' % backupFile[1]
+ os.system("rm -rvf " + homedirs)
+
for username, homedir, uid in add_homedir:
os.system("cp -av /etc/skel " + homedir)
try:
More information about the fedora-extras-commits
mailing list