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 18:58:51

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

Log message:
- enforce os homogeneity when deploying a cluster
- allow 1 node clusters (used to require 2)
- fix a few cases where code was returning a string instead of a list

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/homebase_adapters.py.diff?cvsroot=cluster&r1=1.22&r2=1.23
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/cluster_adapters.py.diff?cvsroot=cluster&r1=1.83&r2=1.84

luci/site/luci/Extensions/homebase_adapters.py +12 -4
@@ -9,6 +9,7 @@
 
 from ricci_defines import *
 from ricci_communicator import RicciCommunicator
+from cluster_adapters import resolveOSType
 
 HOMEBASE_ADD_USER="1"
 HOMEBASE_ADD_SYSTEM="2"
@@ -155,7 +156,7 @@
 		systemName = rc.system_name()
 	except:
 		error = 'Unable to establish a connection to the ricci agent on \"' + host + '\"'
-		return { 'host': host, 'ricci_host': systemName, 'errors': error, 'cur_auth': False }
+		return { 'host': host, 'ricci_host': systemName, 'errors': error, 'cur_auth': False, 'os': None }
 
 
 	if rc.authed():
@@ -163,17 +164,21 @@
 	else:
 		prevAuth = False
 		if not passwd:
-			return { 'host': host, 'ricci_host': systemName, 'prev_auth': False, 'cur_auth': False }
+			return { 'host': host, 'ricci_host': systemName, 'prev_auth': False, 'cur_auth': False, 'os': None}
 		else:
 			try:
 				rc.auth(passwd)
 			except: pass
 
 	if rc.authed():
+		os_str = resolveOSType(rc.os())
+		if os_str == None:
+			os_str = "rhel5"  #Backup plan in case all is almost lost...
+
 		systemName = rc.system_name()
 		if systemName[:9] == 'localhost' or systemName[:5] == '127.0':
 			systemName = host
-		node = { 'host': host, 'ricci_host': systemName, 'prev_auth': prevAuth, 'cur_auth': True }
+		node = { 'host': host, 'ricci_host': systemName, 'prev_auth': prevAuth, 'cur_auth': True, 'os': os_str }
 
 		cluster_info = rc.cluster_info()
 		if cluster and ((not cluster_info) or (cluster_info[0] != cluster)):
@@ -185,7 +190,7 @@
 		return node
 
 	error = 'Unable to authenticate to the ricci agent on \"' + host + '\"'
-	return { 'host': host, 'ricci_host': systemName, 'prev_auth': False , 'cur_auth': False, 'errors': error }
+	return { 'host': host, 'ricci_host': systemName, 'prev_auth': False , 'cur_auth': False, 'errors': error, 'os': None }
 
 def validateAddClusterInitial(self, request):
 	errors = list()
@@ -1181,6 +1186,9 @@
 
 # In case we want to give access to non-admin users in the future
 
+def havePermCreateCluster(self):
+	return isAdmin(self)
+
 def havePermAddStorage(self):
 	return isAdmin(self)
 
luci/site/luci/Extensions/cluster_adapters.py +48 -36

192 lines not on this page · raw message