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 homebase/form-macros site/luci/Exte ...
Date: 13 Oct 2006 17:04:14 -0000	[thread overview]
Message-ID: <20061013170414.30404.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/cluster
Module name:	conga
Changes by:	rmccabe at sourceware.org	2006-10-13 17:04:11

Modified files:
	luci/homebase  : form-macros 
	luci/site/luci/Extensions: homebase_adapters.py ricci_bridge.py 

Log message:
	fix for bz #209997

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/homebase/form-macros.diff?cvsroot=cluster&r1=1.39&r2=1.40
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/homebase_adapters.py.diff?cvsroot=cluster&r1=1.29&r2=1.30
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/ricci_bridge.py.diff?cvsroot=cluster&r1=1.26&r2=1.27

--- conga/luci/homebase/form-macros	2006/10/09 16:16:11	1.39
+++ conga/luci/homebase/form-macros	2006/10/13 17:04:09	1.40
@@ -1,7 +1,7 @@
 <html>
 
 <tal:comment replace="nothing">
-	$Id: form-macros,v 1.39 2006/10/09 16:16:11 rmccabe Exp $
+	$Id: form-macros,v 1.40 2006/10/13 17:04:09 rmccabe Exp $
 </tal:comment>
 
 <head>
@@ -482,19 +482,19 @@
 		set_page_title('Luci ??? homebase ??? Add a running cluster to be managed by Luci');
 	</script>
 
-	<tal:block tal:omit-tag=""
-		tal:define="global sessionObj python:request.SESSION.get('checkRet')" />
+	<tal:block tal:define="
+		global sessionObj python:request.SESSION.get('checkRet')" />
 
-	<form name="adminform" action="" method="post">
+	<h2 class="homebase">Add Cluster</h2>
+
+	<form name="adminform" action="" method="post"
+		tal:condition="python: sessionObj and len(sessionObj)">
 		<input name="pagetype" type="hidden"
 			tal:attributes="value request/form/pagetype | request/pagetype | nothing" />
 
-
 		<input name="absoluteURL" type="hidden"
 			tal:attributes="value python:data['children'][data['curIndex']]['absolute_url']" />
 
-		<h2 class="homebase">Add Cluster</h2>
-
 		<table id="systemsTable" class="systemsTable" border="0" cellspacing="0">
 			<thead class="systemsTable">
 				<tr class="systemsTable"><td class="systemsTable" colspan="2">
@@ -511,10 +511,11 @@
 
 			<tfoot class="systemsTable">
 				<tr class="systemsTable"><td colspan="2" class="systemsTable">
-					<div tal:condition="python: not sessionObj['requestResults']['isComplete']">
+					<div tal:condition="python: not 'isComplete' in sessionObj['requestResults'] or not sessionObj['requestResults']['isComplete']">
 						<input type="checkbox" name="allSameCheckBox" id="allSameCheckBox" onClick="allPasswdsSame(adminform);"/> Check if storage system passwords are identical.
 					</div>
-					<div class="systemsTable" tal:condition="python: sessionObj['requestResults']['isComplete']">&nbsp;</div>
+					<div class="systemsTable"
+						tal:condition="python: 'isComplete' in sessionObj['requestResults'] and sessionObj['requestResults']['isComplete']">&nbsp;</div>
 				</td></tr>
 			</tfoot>
 
@@ -522,7 +523,7 @@
 				tal:define="global sysNum python: 0"
 			/>
 
-			<tbody class="systemsTable">
+			<tbody class="systemsTable" tal:condition="python: 'nodeList' in sessionObj['requestResults']">
 			<tal:block tal:repeat="node python: sessionObj['requestResults']['nodeList']">
 				<span tal:omit-tag=""
 					tal:define="global nodeAuth python: node['cur_auth']" />
@@ -564,6 +565,13 @@
 			<input type="button" name="Submit" value="Add This Cluster" onClick="validateForm(document.adminform);" />
 		</div>
 	</form>
+
+	<div tal:condition="python: not sessionObj or not len(sessionObj)">
+		<span class="error">
+			A data integrity error has occurred. Please attempt to add this cluster to the Luci management interface again.
+		</span>
+		<tal:block tal:define="nop python:here.abortManageCluster(request)" />
+	</div>
 </div>
 
 
--- conga/luci/site/luci/Extensions/homebase_adapters.py	2006/10/12 19:40:44	1.29
+++ conga/luci/site/luci/Extensions/homebase_adapters.py	2006/10/13 17:04:11	1.30
@@ -300,15 +300,38 @@
 			clusterName = request.form['clusterName']
 		except:
 			clusterName = ''
-		return (False, { 'errors': [ 'A data integrity error has occurred. Please attempt adding the cluster again.' ], 'requestResults': { 'clusterName': clusterName } })
+
+		try:
+			nodeList = requestResults['nodeList']
+			nodeUnauth(nodeList)
+		except:
+			pass
+
+		return (False, { 'errors': [ 'A data integrity error has occurred. Please attempt adding the cluster again.' ], 'requestResults': { 'clusterName': clusterName, 'isComplete': False, 'nodeList': [] } })
 		
-	if not 'clusterName' in request.form or request.form['clusterName'] == '':
-		return (False, { 'errors': ['No cluster name given'], 'requestResults': requestResults })
+	try:
+		clusterName = request.form['clusterName']
+		if not clusterName:
+			raise
+	except:
+		return (False, { 'errors': ['No cluster name was given.'], 'requestResults': requestResults })
+
+	try:
+		nodeList = requestResults['nodeList']
+		if not nodeList or len(nodeList) < 1:
+			raise
+	except:
+		return (False, { 'errors': ['No cluster nodes were given.'], 'requestResults': requestResults })
 
-	clusterName = request.form['clusterName']
-	nodeList = requestResults['nodeList']
-	nodeHash = requestResults['nodeHash']
-	rnodeHash = requestResults['rnodeHash']
+	try:
+		nodeHash = requestResults['nodeHash']
+	except:
+		nodeHash = {}
+
+	try:
+		rnodeHash = requestResults['rnodeHash']
+	except:
+		rnodeHash = {}
 
 	# This should never fail
 	try:
@@ -317,6 +340,10 @@
 			raise
 	except:
 		nodeUnauth(nodeList)
+		try:
+			requestResults['isComplete'] = False
+		except:
+			pass
 		return (False, {
 				'errors': [ 'Unknown number of nodes entered' ],
 				'requestResults': requestResults })
@@ -345,7 +372,7 @@
 
 		if not oldNode:
 			nodeUnauth(nodeList)
-			return (False, { 'errors': [ 'A data integrity error has occurred. Please attempt adding the cluster again.' ], 'requestResults': { 'clusterName': clusterName } })
+			return (False, { 'errors': [ 'A data integrity error has occurred. Please attempt adding the cluster again.' ], 'requestResults': { 'clusterName': clusterName, 'nodeList': nodeList, 'isComplete': False } })
 
 		if oldNode['host'] != node['host']:
 			del nodeHash[oldNode['host']]
@@ -679,9 +706,9 @@
 			raise
 		if havePermAddCluster(self):
 			addCluster = {}
-			addCluster['Title'] = 'Add a Cluster'
+			addCluster['Title'] = 'Add an Existing Cluster'
 			addCluster['absolute_url'] = url + '?pagetype=' + HOMEBASE_ADD_CLUSTER
-			addCluster['Description'] = 'Add a cluster to the Luci cluster management interface.'
+			addCluster['Description'] = 'Add an existing cluster to the Luci cluster management interface.'
 			if pagetype == HOMEBASE_ADD_CLUSTER:
 				addCluster['currentItem'] = True
 				ret['curIndex'] = index
@@ -909,7 +936,8 @@
 	try:
 		sessionData = request.SESSION.get('checkRet')
 		nodeUnauth(sessionData['requestResults']['nodeList'])
-	except: pass
+	except:
+		pass
 
 def manageCluster(self, clusterName, nodeList):
 	clusterName = str(clusterName)
--- conga/luci/site/luci/Extensions/ricci_bridge.py	2006/10/12 22:41:27	1.26
+++ conga/luci/site/luci/Extensions/ricci_bridge.py	2006/10/13 17:04:11	1.27
@@ -13,7 +13,6 @@
   def __init__(self, hostname, port=11111):
     self.__hostname = hostname
     self.__port = port
-    return
     
     
   def process(self, xml_out):



             reply	other threads:[~2006-10-13 17:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-13 17:04 rmccabe [this message]
  -- strict thread matches above, loose matches on Subject: below --
2006-10-31 19:09 [Cluster-devel] conga/luci homebase/form-macros site/luci/Exte rmccabe
2006-07-31 17:46 rmccabe
2006-06-30 21:39 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=20061013170414.30404.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.