[Cluster-devel] conga/luci/utils luci_admin

rmccabe at sourceware.org rmccabe at sourceware.org
Tue Jun 27 19:50:11 UTC 2006


CVSROOT:	/cvs/cluster
Module name:	conga
Changes by:	rmccabe at sourceware.org	2006-06-27 19:50:10

Modified files:
	luci/utils     : luci_admin 

Log message:
	fix for fc5 works on fc6, too and lets me get rid of all the temporary file ugliness

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

--- conga/luci/utils/luci_admin	2006/06/27 19:40:37	1.22
+++ conga/luci/utils/luci_admin	2006/06/27 19:50:09	1.23
@@ -23,7 +23,6 @@
 LUCI_CERT_DIR='/var/lib/luci/var/certs/'
 LUCI_BACKUP_PATH=LUCI_BACKUP_DIR + '/luci_backup.xml'
 LUCI_DB_PATH='/var/lib/luci/var/Data.fs'
-LUCI_TEMP='/var/lib/luci/var/temp/'
 
 INITUSER_FILE_PATH = '/var/lib/luci/inituser'
 
@@ -143,8 +142,11 @@
 	import Products.CMFCore
 	sys.stderr = orig_stderr
 	import Products.CMFCore.MemberDataTool
-	# This is why I love zope.
 	import ImageFile
+
+	# Zope wants to open a www/ok.gif and images/error.gif
+	# when you initialize the application object. This keeps
+	# the AppInitializer(app).initialize() call below from failing.
 	ImageFile.ImageFile.__init__ = lambda x,y,z:None
 
 	if len(argv) > 0:
@@ -922,35 +924,6 @@
 	try: os.umask(077)
 	except: pass
 
-	# for reasons that make no sense, zope/plone will fall
-	# on its face if www/ok.gif and images/version.gif don't
-	# exist and have at least something in them.
-	try:
-		os.makedirs(LUCI_TEMP + 'www')
-		os.makedirs(LUCI_TEMP + 'images')
-	except: pass
-
-	try:
-		f = file(LUCI_TEMP + 'www/ok.gif', 'w')
-		f.write('luci\n')
-		f.close()
-
-		f = file(LUCI_TEMP + 'images/version.gif', 'w')
-		f.write('luci\n')
-		f.close()
-	except:
-		try:
-			os.unlink(LUCI_TEMP + 'www/ok.gif')
-			os.unlink(LUCI_TEMP + 'images/version.gif')
-			os.rmdir(LUCI_TEMP + 'www')
-			os.rmdir(LUCI_TEMP + 'images')
-			os.rmdir(LUCI_TEMP)
-		except: pass
-		print 'Unable to initialize restore.'
-		sys.exit(1)
-
-	os.chdir(LUCI_TEMP)
-
 	ret = True
 	if luci_restore(argv[2:]):
 		print 'The Luci restore failed. Try reinstalling Luci, then restoring again.'
@@ -959,20 +932,12 @@
 		print 'Restore was successful.'
 		restart_message()
 
-	os.chdir(LUCI_BACKUP_DIR)
-	try:
-		os.unlink(LUCI_TEMP + 'www/ok.gif')
-		os.unlink(LUCI_TEMP + 'images/version.gif')
-		os.rmdir(LUCI_TEMP + 'www')
-		os.rmdir(LUCI_TEMP + 'images')
-		os.rmdir(LUCI_TEMP)
-	except: pass
-
 	try:
 		luci = pwd.getpwnam(LUCI_USER)[2:4]
 		os.chown(LUCI_DB_PATH, luci[0], luci[1])
 		os.chmod(LUCI_DB_PATH, 0600)
 	except:
+		ret = False
 		sys.stderr.write('Unable to change ownership of the Luci database back to user \"' + LUCI_USER + '\"\n')
 
 	return ret




More information about the Cluster-devel mailing list