From mboxrd@z Thu Jan 1 00:00:00 1970 From: rmccabe@sourceware.org Date: 11 Jul 2006 18:46:48 -0000 Subject: [Cluster-devel] conga/luci/utils luci_admin Message-ID: <20060711184648.5715.qmail@sourceware.org> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 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 --- conga/luci/utils/luci_admin 2006/07/11 14:51:32 1.26 +++ conga/luci/utils/luci_admin 2006/07/11 18:46:47 1.27 @@ -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...'