From mboxrd@z Thu Jan 1 00:00:00 1970 From: rmccabe@sourceware.org Date: 21 Jun 2006 17:06:45 -0000 Subject: [Cluster-devel] conga/luci/utils luci_admin Message-ID: <20060621170645.1592.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-06-21 17:06:44 Modified files: luci/utils : luci_admin Log message: cleanups Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/utils/luci_admin.diff?cvsroot=cluster&r1=1.15&r2=1.16 --- conga/luci/utils/luci_admin 2006/06/18 15:02:47 1.15 +++ conga/luci/utils/luci_admin 2006/06/21 17:06:44 1.16 @@ -24,6 +24,7 @@ SSL_KEYCONFIG_PATH='/var/lib/luci/var/certs/cacert.config' LUCI_BACKUP_PATH='/var/lib/luci/var/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' @@ -198,11 +199,11 @@ systemList = node.getElementsByTagName('systemList') if not systemList or len(systemList) < 1: - sys.write.stderr('No storage systems to add') + verbose.write('No storage systems to add') else: systemList = systemList[0].getElementsByTagName('system') if len(systemList) < 1: - sys.write.stderr('No storage systems to add') + verbose.write('No storage systems to add') for s in systemList: id = s.getAttribute('id') @@ -255,11 +256,11 @@ clusterList = node.getElementsByTagName('clusterList') if not clusterList or len(clusterList) < 1: - verbose('No clusters to add') + verbose.write('No clusters to add') else: clusterList = clusterList[0].getElementsByTagName('cluster') if len(clusterList) < 1: - verbose('No clusters to add') + verbose.write('No clusters to add') for c in clusterList: id = c.getAttribute('id') @@ -810,7 +811,7 @@ except: pass if luci_backup(argv[2:]): - sys.write.stderr('The Luci backup failed.\n') + sys.stderr.write('The Luci backup failed.\n') sys.exit(1) print 'Backup was successful. The backup file is',LUCI_BACKUP_PATH @@ -825,13 +826,45 @@ def restore(argv): print 'Restoring the Luci server...' + # 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@least something in them. + try: + os.makedirs(LUCI_TEMP + 'www') + os.makedirs(LUCI_TEMP + 'images') + except:pass + + try: + os.chdir(LUCI_TEMP) + 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: + os.unlink(LUCI_TEMP + 'www/ok.gif') + os.unlink(LUCI_TEMP + 'images/version.gif') + os.removedirs(LUCI_TEMP) + print 'Unable to initialize restore.' + sys.exit(1) + + ret = True if luci_restore(argv[2:]): print 'The Luci restore failed. Try reinstalling Luci, then restoring again.' - sys.exit(1) + ret = False + else: + print 'Restore was successful.' + restart_message() + + try: + os.unlink(LUCI_TEMP + 'www/ok.gif') + os.unlink(LUCI_TEMP + 'images/version.gif') + os.removedirs(LUCI_TEMP) + except: pass - print 'Restore was successful.' - restart_message() - return True + return ret def luci_help(argv):