Skip to contentSkip to conversation

conga/luci/utils luci_admin

Cluster-devel [email protected] 1 participant 1 message Jul 11, 2006

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/cluster
Module name: conga
Changes by: rmccabe at sourceware.org 2006-07-11 18:46:48

Modified files:
luci/utils : luci_admin

Log message:

	more zope2.9/plone2.5 fixes

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

luci/utils/luci_admin +24 -10
@@ -6,16 +6,23 @@
 import xml
 import xml.dom
 from xml.dom import minidom
-
+	
 sys.path.extend((
 	'/usr/lib64/zope/lib64/python',
-	'/usr/lib64/zope/lib64/python/Products',
 	'/usr/lib64/zope/lib/python',
-	'/usr/lib64/zope/lib/python/Products',
 	'/usr/lib/zope/lib/python',
+	'/usr/lib64/zope/lib/python/Products',
+	'/usr/lib64/zope/lib64/python/Products',
 	'/usr/lib/zope/lib/python/Products'
 ))
 
+from Products import __path__
+__path__.extend((
+	'/usr/lib64/zope/lib/python/Products',
+	'/usr/lib64/zope/lib64/python/Products',
+	'/usr/lib/zope/lib/python/Products',
+))
+
 LUCI_INIT_DEBUG = 0
 
 LUCI_USER='luci'
@@ -209,12 +216,13 @@
 		sys.stderr.write('An error occurred while initializing the Luci installation for restoration from backup\n')
 		return -1
 
-	try:
+	if True:
+		print app.unrestrictedTraverse('/luci/')
 		portal_mem = app.unrestrictedTraverse('/luci/portal_membership')
 		portal_reg = app.unrestrictedTraverse('/luci/portal_registration')
 		if not portal_mem or not portal_reg:
 			raise
-	except:
+	else:
 		sys.stderr.write('Your Luci installation appears to be corrupt.\n')
 		return -1
 
@@ -905,7 +913,7 @@
 					os.rename(LUCI_BACKUP_PATH, oldbackup)
 				except:
 					sys.stderr.stderr('Unable to rename the existing backup file.\n')
-					sys.exit(1)
+					return -1
 				break
 			trynum += 1
 	except OSError, e:
@@ -923,13 +931,19 @@
 	except OSError, e:
 		print "An error occurred while making",LUCI_BACKUP_PATH,"read-only:",e
 		print "Please check that this file is not world-readable."
+
 	if not doc:
 		sys.stderr.write('The Luci backup failed.\n')
-		sys.exit(1)
+		return -1
+
+	try:
+		f.write(doc.toprettyxml())
+		f.close()
+	except:
+		sys.stderr.write('The Luci backup failed.\n')
+		return -1
 
-	f.write(doc.toprettyxml())
-	f.flush()
-	f.close()
+	print 'Luci backup was successful.\nThe backup data is contained in the file \"' + LUCI_BACKUP_PATH + '\"'
 
 def restore(argv):
 	print 'Restoring the Luci server...'