Skip to contentSkip to conversation

conga/luci/site/luci/Extensions homebase_adapt ...

Cluster-devel [email protected] 1 participant 1 message Oct 6, 2006

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/cluster
Module name: conga
Changes by: rmccabe at sourceware.org 2006-10-06 20:45:27

Modified files:
luci/site/luci/Extensions: homebase_adapters.py
cluster_adapters.py
Added files:
luci/site/luci/Extensions: clusterOS.py UnknownClusterError.py

Log message:
move resolveOSType to a new file clusterOS.py to break a circular import dependency create UnknownClusterError as a couple of functions in cluster_adapters try to throw this kind of exception fix a few other small bugs

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/clusterOS.py.diff?cvsroot=cluster&r1=NONE&r2=1.1
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/UnknownClusterError.py.diff?cvsroot=cluster&r1=NONE&r2=1.1
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/homebase_adapters.py.diff?cvsroot=cluster&r1=1.23&r2=1.24
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/cluster_adapters.py.diff?cvsroot=cluster&r1=1.84&r2=1.85

/cvs/cluster/conga/luci/site/luci/Extensions/clusterOS.py,v --> standard output revision 1.1

- renamed from luci/site/luci/Extensions/clusterOS.py +5 -0
@@ -0,0 +1,5 @@
+def resolveOSType(os):
+	if os.find("Tikanga") != (-1) or os.find("FC6") != (-1):
+		return "rhel5"
+	else:
+		return "rhel4"

/cvs/cluster/conga/luci/site/luci/Extensions/UnknownClusterError.py,v --> standard output revision 1.1

- renamed from luci/site/luci/Extensions/UnknownClusterError.py +14 -0
@@ -0,0 +1,14 @@
+"""Exception class for throwing except on an 
+   unknown cluster error that occurred during
+   a batch command.
+"""
+
+class UnknownClusterError:
+    def __init__(self, severity, message):
+        self.__severity     = severity
+        self.__msg          = message
+    def getSeverity(self):
+        return self.__severity
+    def getMessage(self):
+        return self.__msg
+
luci/site/luci/Extensions/homebase_adapters.py +9 -36

83 lines not on this page · raw message

luci/site/luci/Extensions/cluster_adapters.py +7 -10
@@ -12,10 +12,14 @@
 from Clusterfs import Clusterfs
 from Fs import Fs
 from NFSClient import NFSClient
+from NFSExport import NFSExport
 from Netfs import Netfs
 from Script import Script
 from Samba import Samba
+from clusterOS import resolveOSType
 from GeneralError import GeneralError
+from UnknownClusterError import UnknownClusterError
+from homebase_adapters import nodeUnauth, nodeAuth, manageCluster, createClusterSystems, havePermCreateCluster
 
 #Policy for showing the cluster chooser menu:
 #1) If there are no clusters in the ManagedClusterSystems
@@ -25,8 +29,6 @@
 #then only display chooser if the current user has
 #permissions on at least one. If the user is admin, show ALL clusters
 
-from homebase_adapters import nodeAuth, nodeUnauth, manageCluster, createClusterSystems, havePermCreateCluster
-
 CLUSTER_FOLDER_PATH = '/luci/systems/cluster/'
 
 def validateClusterNodes(request, sessionData, clusterName, numStorage):
@@ -136,6 +138,7 @@
 	except:
 		errors.append('A cluster must contain at least one node')
 
+	cluster_os = None
 	try:
 		cluster_os = nodeList[0]['os']
 		if not cluster_os:
@@ -154,7 +157,7 @@
 		return (False, {'errors': errors, 'requestResults':cluster_properties })
 
 	if cluster_properties['isComplete'] == True:
-		batchNode = createClusterBatch(os_str, clusterName, clusterName, map(lambda x: x['ricci_host'], nodeList), True, False, False)
+		batchNode = createClusterBatch(cluster_os, clusterName, clusterName, map(lambda x: x['ricci_host'], nodeList), True, False, False)
 		if not batchNode:
 			nodeUnauth(nodeList)
 			cluster_properties['isComplete'] = False
@@ -350,7 +353,7 @@
 	except KeyError, e:
 		errors.append('No Interval value was given.')
 	except ValueError, e:
-		errros.append('An invalid Interval value was given: ' + e)
+		errors.append('An invalid Interval value was given: ' + e)
 
 	try:
 		votes = int(form['votes'])
@@ -2186,12 +2189,6 @@
 	map['isVirtualized'] = rc.dom0()
 	return map
 
-def resolveOSType(os):
-  if os.find("Tikanga") != (-1) or os.find("FC6") != (-1):
-    return "rhel5"
-  else:
-    return "rhel4"
-
 def getResourcesInfo(modelb, request):
 	resList = list()
 	baseurl = request['URL']