All of lore.kernel.org
 help / color / mirror / Atom feed
From: rmccabe@sourceware.org <rmccabe@sourceware.org>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] conga/luci/utils luci_admin
Date: 21 Jun 2006 17:06:45 -0000	[thread overview]
Message-ID: <20060621170645.1592.qmail@sourceware.org> (raw)

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):



             reply	other threads:[~2006-06-21 17:06 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-21 17:06 rmccabe [this message]
  -- strict thread matches above, loose matches on Subject: below --
2011-03-25 20:14 [Cluster-devel] conga/luci/utils luci_admin rmccabe
2007-09-19  5:17 rmccabe
2007-08-10 18:36 rmccabe
2007-08-10 18:33 rmccabe
2007-08-10 18:32 rmccabe
2007-08-07 20:22 rmccabe
2006-10-13  6:56 kupcevic
2006-08-18 18:03 rmccabe
2006-08-04 19:19 rmccabe
2006-08-04 18:37 rmccabe
2006-08-03 22:58 kupcevic
2006-08-03 21:19 rmccabe
2006-08-03 21:11 rmccabe
2006-08-03 16:32 rmccabe
2006-08-03 15:55 rmccabe
2006-08-03 12:26 rmccabe
2006-08-03  3:58 rmccabe
2006-08-03  3:30 rmccabe
2006-08-02 23:29 rmccabe
2006-08-02 20:52 rmccabe
2006-08-02 20:45 rmccabe
2006-07-26  1:17 rmccabe
2006-07-25 22:36 rmccabe
2006-07-11 18:46 rmccabe
2006-07-11 14:51 rmccabe
2006-06-29 18:04 rmccabe
2006-06-29 17:51 rmccabe
2006-06-27 19:50 rmccabe
2006-06-27 19:40 rmccabe
2006-06-27 18:19 rmccabe
2006-06-26 22:30 rmccabe
2006-06-26 20:01 rmccabe
2006-06-21 23:06 rmccabe
2006-06-21 17:41 rmccabe
2006-06-18 15:02 rmccabe
2006-06-18 12:50 rmccabe
2006-06-18  3:26 rmccabe
2006-06-16 23:19 rmccabe
2006-06-16 19:35 rmccabe
2006-06-16 18:17 rmccabe
2006-06-16 17:44 rmccabe
2006-06-16  5:35 rmccabe
2006-06-13 18:42 rmccabe
2006-06-13 17:36 rmccabe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060621170645.1592.qmail@sourceware.org \
    --to=rmccabe@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.