[Cluster-devel] conga/luci/utils luci_admin

rmccabe at sourceware.org rmccabe at sourceware.org
Thu Jun 29 18:04:34 UTC 2006


CVSROOT:	/cvs/cluster
Module name:	conga
Changes by:	rmccabe at sourceware.org	2006-06-29 18:04:32

Modified files:
	luci/utils     : luci_admin 

Log message:
	make sure auxiliary DB files have the correct ownership after backup and restore.

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

--- conga/luci/utils/luci_admin	2006/06/29 17:51:12	1.24
+++ conga/luci/utils/luci_admin	2006/06/29 18:04:31	1.25
@@ -875,10 +875,15 @@
 	try: os.umask(077)
 	except: pass
 
+	try:
+		luci = pwd.getpwnam(LUCI_USER)[2:4]
+	except:
+		sys.stderr.write('Cannot find the \"' + LUCI_USER + '\" user.\n')
+		return -1
+
 	doc = luci_backup(argv[2:])
 
 	try:
-		luci = pwd.getpwnam(LUCI_USER)[2:4]
 		os.chown(LUCI_DB_PATH, luci[0], luci[1])
 		os.chmod(LUCI_DB_PATH, 0600)
 	except:
@@ -930,10 +935,9 @@
 	try: os.umask(077)
 	except: pass
 
-	ret = True
 	if luci_restore(argv[2:]):
 		print 'The Luci restore failed. Try reinstalling Luci, then restoring again.'
-		ret = False
+		return False
 	else:
 		print 'Restore was successful.'
 		restart_message()
@@ -942,11 +946,16 @@
 		luci = pwd.getpwnam(LUCI_USER)[2:4]
 		os.chown(LUCI_DB_PATH, luci[0], luci[1])
 		os.chmod(LUCI_DB_PATH, 0600)
+		for i in [ '.tmp', '.old', '.index', '.lock' ]:
+			try:
+				os.chown(LUCI_DB_PATH + i, luci[0], luci[1])
+				os.chmod(LUCI_DB_PATH + i, 0600)
+			except: pass
 	except:
-		ret = False
 		sys.stderr.write('Unable to change ownership of the Luci database back to user \"' + LUCI_USER + '\"\n')
+		return False
 
-	return ret
+	return True
 
 
 def luci_help(argv):




More information about the Cluster-devel mailing list