Skip to contentSkip to conversation

conga/luci/utils luci_admin

Cluster-devel [email protected] 1 participant 1 message Aug 10, 2007

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/cluster
Module name: conga
Changes by: rmccabe at sourceware.org 2007-08-10 18:36:31

Modified files:
luci/utils : luci_admin

Log message:
- backup returns -1, not 0 on failure.
- do not warn about not being about to chown/chmod nonexistent backups

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/utils/luci_admin.diff?cvsroot=cluster&r1=1.54&r2=1.55

luci/utils/luci_admin +8 -3
@@ -161,12 +161,17 @@
 		os.chmod(LUCI_DB_PATH, 0600)
 		for ext in [ '.tmp', '.old', '.index', '.lock' ]:
 			cur_path = '%s%s' % (LUCI_DB_PATH, ext)
+
 			try:
 				os.chown(cur_path, uid, gid)
 				os.chmod(cur_path, 0600)
+			except OSError, eieio:
+				if eieio[0] != 2:
+					sys.stderr.write('Unable to change ownership of "%s" back to user "%s": %s\n' \
+						% (cur_path, LUCI_USER, str(eieio)))
 			except Exception, ei:
-				sys.stderr.write('Unable to change ownership of "%s" to user "%s": %s\n' \
-					% (cur_path, LUCI_USER, str(ei)))
+				sys.stderr.write('Unable to change ownership of "%s" to user "%s": %s %r\n' \
+					% (cur_path, LUCI_USER, str(ei), ei))
 	except Exception, e:
 		sys.stderr.write('Unable to change ownership of the Luci database "%s" back to user "%s": %s\n' \
 			% (LUCI_DB_PATH, LUCI_USER, str(e)))
@@ -1140,7 +1145,7 @@
 
 	doc = luci_backup(argv[2:])
 	restore_luci_db_fsattr()
-	if not doc:
+	if doc == -1:
 		sys.stderr.write('The Luci backup failed. Exiting.\n')
 		sys.exit(1)