[Cluster-devel] conga/luci/site/luci/Extensions homebase_adapt ...
rmccabe at sourceware.org
rmccabe at sourceware.org
Fri Oct 6 20:45:27 UTC 2006
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']
More information about the Cluster-devel
mailing list