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/site/luci/Extensions homebase_adapt ...
Date: 6 Oct 2006 20:45:27 -0000	[thread overview]
Message-ID: <20061006204527.24961.qmail@sourceware.org> (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
--- conga/luci/site/luci/Extensions/clusterOS.py
+++ -	2006-10-06 20:45:27.366723000 +0000
@@ -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
--- conga/luci/site/luci/Extensions/UnknownClusterError.py
+++ -	2006-10-06 20:45:27.449955000 +0000
@@ -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
+
--- conga/luci/site/luci/Extensions/homebase_adapters.py	2006/10/06 18:58:51	1.23
+++ conga/luci/site/luci/Extensions/homebase_adapters.py	2006/10/06 20:45:26	1.24
@@ -9,7 +9,8 @@
 
 from ricci_defines import *
 from ricci_communicator import RicciCommunicator
-from cluster_adapters import resolveOSType
+from ricci_communicator import CERTS_DIR_PATH
+from clusterOS import resolveOSType
 
 HOMEBASE_ADD_USER="1"
 HOMEBASE_ADD_SYSTEM="2"
@@ -24,7 +25,6 @@
 class InCluster(Exception):
 	pass
 
-from ricci_communicator import CERTS_DIR_PATH
 def siteIsSetup(self):
 	try:
 		if os.path.isfile(CERTS_DIR_PATH + 'privkey.pem') and os.path.isfile(CERTS_DIR_PATH + 'cacert.pem'):
@@ -301,6 +301,10 @@
 		sessionData = request.SESSION.get('checkRet')
 		requestResults = sessionData['requestResults']
 	except:
+		try:
+			clusterName = request.form['clusterName']
+		except:
+			clusterName = ''
 		return (False, { 'errors': [ 'A data integrity error has occurred. Please attempt adding the cluster again.' ], 'requestResults': { 'clusterName': clusterName } })
 		
 	if not 'clusterName' in request.form or request.form['clusterName'] == '':
@@ -357,7 +361,7 @@
 			if oldNode['ricci_host'] in rnodeHash:
 				del rnodeHash[oldNode['ricci_host']]
 				oldNode['ricci_host'] = node['ricci_host']
-				rnodeHashnode[node['ricci_host']] = oldNode
+				rnodeHash[node['ricci_host']] = oldNode
 
 		oldNode['cur_auth'] = node['cur_auth']
 		if 'errors' in node:
@@ -903,9 +907,10 @@
 		newSystem.manage_role('View', ['Access contents information','View'])
 	except:
 		return 'Unable to set permissions on new system \"' + host + '\"'
+
 	return None
 
-def abortManageCluster(self):
+def abortManageCluster(self, request):
 	try:
 		sessionData = request.SESSION.get('checkRet')
 		nodeUnauth(sessionData['requestResults']['nodeList'])
@@ -1076,38 +1081,6 @@
 	except:
 		return 'Unable to delete storage system \"' + systemName + '\"'
 
-
-def delSystem(self, systemName):
-	try:
-		ssystem = self.restrictedTraverse(PLONE_ROOT + '/systems/storage/')
-	except:
-		return 'Unable to find storage system \"' + systemName + '\"'
-
-	try:
-		rc = RicciCommunicator(systemName)
-		if not rc:
-			raise
-	except:
-		return 'Unable to connect to the ricci agent on \"' + systemName + '\" to unauthenticate'
-
-	# Only unauthenticate if the system isn't a member of
-	# a managed cluster.
-	cluster_info = rc.cluster_info()
-	if not cluster_info[0]:
-		try: rc.unauth()
-		except: pass
-	else:
-		try:
-			newSystem = self.restrictedTraverse(PLONE_ROOT + '/systems/cluster/' + cluster_info[0] + '/' + rc.system_name())
-		except:
-			try: rc.unauth()
-			except: pass
-
-	try:
-		ssystem.manage_delObjects([systemName])
-	except:
-		return 'Unable to delete storage system \"' + systemName + '\"'
-
 def delCluster(self, clusterName):
 	try:
 		clusters = self.restrictedTraverse(PLONE_ROOT + '/systems/cluster/')
--- conga/luci/site/luci/Extensions/cluster_adapters.py	2006/10/06 18:58:51	1.84
+++ conga/luci/site/luci/Extensions/cluster_adapters.py	2006/10/06 20:45:26	1.85
@@ -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']



             reply	other threads:[~2006-10-06 20:45 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-06 20:45 rmccabe [this message]
  -- strict thread matches above, loose matches on Subject: below --
2008-04-21 18:19 [Cluster-devel] conga/luci/site/luci/Extensions homebase_adapt rmccabe
2008-02-05 20:59 rmccabe
2007-06-06 15:14 rmccabe
2007-01-29 22:06 rmccabe
2007-01-08 19:49 rmccabe
2007-01-08 19:46 rmccabe
2006-11-02 21:12 rmccabe
2006-11-01 20:34 rmccabe
2006-10-30 20:20 rmccabe
2006-10-26 16:57 rmccabe
2006-10-16 15:18 rmccabe
2006-10-13 17:12 rmccabe
2006-10-11 21:48 rmccabe
2006-10-11 18:44 rmccabe
2006-10-06 18:58 rmccabe
2006-10-04 13:25 jparsons
2006-08-01 16:27 rmccabe
2006-07-27 13:37 jparsons
2006-07-26 19:50 rmccabe
2006-07-25 17:45 rmccabe
2006-07-18 19:26 rmccabe
2006-06-27 20:53 rmccabe
2006-06-27 20:47 rmccabe
2006-06-27 17:49 rmccabe
2006-06-26 20:10 rmccabe
2006-06-22  3:58 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=20061006204527.24961.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.