[Cluster-devel] conga/luci/site/luci/Extensions cluster_adapte ...

rmccabe at sourceware.org rmccabe at sourceware.org
Wed Jul 19 21:38:37 UTC 2006


CVSROOT:	/cvs/cluster
Module name:	conga
Changes by:	rmccabe at sourceware.org	2006-07-19 21:38:36

Modified files:
	luci/site/luci/Extensions: cluster_adapters.py 
	                           homebase_adapters.py ricci_bridge.py 

Log message:
	flesh out cluster creation

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/cluster_adapters.py.diff?cvsroot=cluster&r1=1.4&r2=1.5
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/homebase_adapters.py.diff?cvsroot=cluster&r1=1.14&r2=1.15
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/ricci_bridge.py.diff?cvsroot=cluster&r1=1.5&r2=1.6

--- conga/luci/site/luci/Extensions/cluster_adapters.py	2006/07/19 20:57:39	1.4
+++ conga/luci/site/luci/Extensions/cluster_adapters.py	2006/07/19 21:38:36	1.5
@@ -2,7 +2,7 @@
 from ZPublisher import HTTPRequest
 import AccessControl
 from conga_constants import *
-from ricci_bridge import ricci_bridge
+from ricci_bridge import *
 import time
 import Products.ManagedSystem
 
@@ -23,6 +23,7 @@
 		return
 
 	errors = list()
+	messages = list()
 	nodeList = list()
 	nodeHash = {}
 	rnodeHash = {}
@@ -107,13 +108,29 @@
 	}
 
 	if cluster_properties['isComplete'] != True:
+		nodeUnauth(nodeList)
 		return (False, {'errors': errors, 'requestResults':cluster_properties })
 
 	if cluster_properties['isComplete'] == True:
+		batchNode = createClusterBatch(clusterName, clusterName, map(lambda x: x['ricci_host'], nodeList), True, False, False)
+		if not batchNode:
+			nodeUnauth(nodeList)
+			cluster_properties['isComplete'] = False
+			errors.append('Unable to generate cluster creation ricci command')
+			return (False, {'errors': errors, 'requestResults':cluster_properties })
+
 		for i in nodeList:
-			i = i # yell at ricci
+			try:
+				rc = RicciCommunicator(i['ricci_host'])
+				resultNode = rc.process_batch(batchNode, async=True)
+			except:
+				nodeUnauth(nodeList)
+				cluster_properties['isComplete'] = False
+				errors.append('An error occurred while attempting to add cluster node \"' + i['ricci_host'] + '\"')
+				return (False, {'errors': errors, 'requestResults':cluster_properties })
 
-	return (len(errors) < 1, {'errors': errors, 'messages': messages })
+	messages.append('Creation of cluster \"' + clusterName + '\" has begun')
+	return (True, {'errors': errors, 'messages': messages })
 
 def createCluChooser(self, request, systems):
   dummynode = {}
--- conga/luci/site/luci/Extensions/homebase_adapters.py	2006/07/19 20:19:53	1.14
+++ conga/luci/site/luci/Extensions/homebase_adapters.py	2006/07/19 21:38:36	1.15
@@ -137,10 +137,11 @@
 def nodeUnauth(nodeList):
 	for i in nodeList:
 		try:
-			if i['prev_auth'] == True:
+			if i['prev_auth'] != True:
 				host = i['host']
 				rc = RicciCommunicator(host)
 				rc.unauth()
+				i['cur_auth'] = False
 		except:
 			pass
 
--- conga/luci/site/luci/Extensions/ricci_bridge.py	2006/07/19 21:02:32	1.5
+++ conga/luci/site/luci/Extensions/ricci_bridge.py	2006/07/19 21:38:36	1.6
@@ -571,3 +571,5 @@
     batch += '</request>'
     batch += '</module>'
     batch += '</batch>'
+
+	return minidom.parseString(batch).firstChild




More information about the Cluster-devel mailing list