[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Cluster-devel] conga/luci homebase/form-macros site/luci/Exte ...



CVSROOT:	/cvs/cluster
Module name:	conga
Changes by:	rmccabe 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):


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]