[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Cluster-devel] conga/luci cluster/form-macros homebase/homeba ...



CVSROOT:	/cvs/cluster
Module name:	conga
Changes by:	rmccabe sourceware org	2007-07-12 15:44:43

Modified files:
	luci/cluster   : form-macros 
	luci/homebase  : homebase_common.js 
	luci/site/luci/Extensions: FenceHandler.py LuciClusterInfo.py 
	                           PropsObject.py homebase_adapters.py 

Log message:
	- Cleanups
	- Better exception handling and error logging for fence validation

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/form-macros.diff?cvsroot=cluster&r1=1.202&r2=1.203
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/homebase/homebase_common.js.diff?cvsroot=cluster&r1=1.18&r2=1.19
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/FenceHandler.py.diff?cvsroot=cluster&r1=1.19&r2=1.20
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/LuciClusterInfo.py.diff?cvsroot=cluster&r1=1.5&r2=1.6
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/PropsObject.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.51&r2=1.52

--- conga/luci/cluster/form-macros	2007/07/12 02:42:42	1.202
+++ conga/luci/cluster/form-macros	2007/07/12 15:44:43	1.203
@@ -3273,7 +3273,7 @@
 
 	<div id="fence_selection_block" class="invisible">
 		<form name="main_fence_form">
-			<select name="select_div" onchange="alert('ALERT')">
+			<select name="select_div">
 				<option value="fence-form-new-device">------ Use an existing Fence Device ------</option>
 				<tal:block tal:repeat="f fencedevinfo/fencedevs">
 					<option class="shared_fencedev"
--- conga/luci/homebase/homebase_common.js	2007/07/11 22:47:07	1.18
+++ conga/luci/homebase/homebase_common.js	2007/07/12 15:44:43	1.19
@@ -281,13 +281,13 @@
 	del_img.className = 'deleteRow';
 	del_img.onclick = new Function('delete_element_id(\'' + newrow.id + '\')');
 
-	sltab.appendChild(newrow);
 	dcol.appendChild(del_img);
 	hcol.appendChild(newsys);
 	pcol.appendChild(newsysp);
 	newrow.appendChild(hcol);
 	newrow.appendChild(pcol);
 	newrow.appendChild(dcol);
+	sltab.appendChild(newrow);
 
 	form.numStorage.value = ++num_systems;
 	if (num_systems === 2) {
--- conga/luci/site/luci/Extensions/FenceHandler.py	2007/06/25 16:03:38	1.19
+++ conga/luci/site/luci/Extensions/FenceHandler.py	2007/07/12 15:44:43	1.20
@@ -6,6 +6,8 @@
 # Free Software Foundation.
 
 from ClusterModel.Device import Device
+from conga_constants import LUCI_DEBUG_MODE
+from LuciSyslog import get_logger
 
 FD_VAL_FAIL = 1
 FD_VAL_SUCCESS = 0
@@ -152,6 +154,7 @@
 	'fence_manual': ['name']
 }
 
+luci_log = get_logger()
 
 def makeNCName(name):
 	### name must conform to relaxNG ID type ##
@@ -178,6 +181,8 @@
 			model.setModified(True)
 			return (FD_VAL_SUCCESS, fencedev.getAttribute('name'))
 	except Exception, e:
+		if LUCI_DEBUG_MODE is True:
+			luci_log.debug_verbose('VNFD0: %r %s' % (e, str(e)))
 		ret = [ FD_PROVIDE_AGENT ]
 
 	return (FD_VAL_FAIL, ret)
@@ -188,6 +193,8 @@
 		if not old_fence_name:
 			raise Exception, 'blank'
 	except Exception, e:
+		if LUCI_DEBUG_MODE is True:
+			luci_log.debug_verbose('VFD0: %r %s' % (e, str(e)))
 		return (FD_VAL_FAIL, [ FD_PROVIDE_NAME ])
 
 	fencedev = None
@@ -200,6 +207,8 @@
 		if fencedev is None:
 			raise Exception, 'fencedev is None'
 	except Exception, e:
+		if LUCI_DEBUG_MODE is True:
+			luci_log.debug_verbose('VFD1: %r %s' % (e, str(e)))
 		return (FD_VAL_FAIL, [ FD_PROVIDE_NAME ])
 
 	try:
@@ -208,6 +217,8 @@
 			model.setModified(True)
 			return (FD_VAL_SUCCESS, fencedev.getAttribute('name'))
 	except Exception, e:
+		if LUCI_DEBUG_MODE is True:
+			luci_log.debug_verbose('VFD2: %r %s' % (e, str(e)))
 		ret = [ FD_PROVIDE_NAME ]
 
 	return (FD_VAL_FAIL, ret)
@@ -219,6 +230,7 @@
 		ip = form['ipaddr'].strip()
 		if not ip:
 			raise Exception, 'blank'
+		fencedev.addAttribute('ipaddr', ip)
 	except Exception, e:
 		errors.append(FD_PROVIDE_IP)
 
@@ -226,6 +238,7 @@
 		log = form['login'].strip()
 		if not log:
 			raise Exception, 'blank'
+		fencedev.addAttribute('login', log)
 	except Exception, e:
 		errors.append(FD_PROVIDE_LOGIN)
 
@@ -257,8 +270,6 @@
 	if not has_passwd:
 		errors.append(FD_PROVIDE_PASSWD)
 
-	fencedev.addAttribute('ipaddr', ip)
-	fencedev.addAttribute('login', log)
 	return errors
 
 def val_wti_fd(form, fencedev):
@@ -268,6 +279,7 @@
 		ip = form['ipaddr'].strip()
 		if not ip:
 			raise Exception, 'blank'
+		fencedev.addAttribute('ipaddr', ip)
 	except Exception, e:
 		errors.append(FD_PROVIDE_IP)
 
@@ -299,7 +311,6 @@
 	if not has_passwd:
 		errors.append(FD_PROVIDE_PASSWD)
 
-	fencedev.addAttribute('ipaddr', ip)
 	return errors
 
 def val_brocade_fd(form, fencedev):
@@ -309,6 +320,7 @@
 		ip = form['ipaddr'].strip()
 		if not ip:
 			raise Exception, 'blank'
+		fencedev.addAttribute('ipaddr', ip)
 	except Exception, e:
 		errors.append(FD_PROVIDE_IP)
 
@@ -316,6 +328,7 @@
 		log = form['login'].strip()
 		if not log:
 			raise Exception, 'blank'
+		fencedev.addAttribute('login', log)
 	except Exception, e:
 		errors.append(FD_PROVIDE_LOGIN)
 
@@ -347,8 +360,6 @@
 	if not has_passwd:
 		errors.append(FD_PROVIDE_PASSWD)
 
-	fencedev.addAttribute('ipaddr', ip)
-	fencedev.addAttribute('login', log)
 	return errors
 
 def val_vixel_fd(form, fencedev):
@@ -358,6 +369,7 @@
 		ip = form['ipaddr'].strip()
 		if not ip:
 			raise Exception, 'blank'
+		fencedev.addAttribute('ipaddr', ip)
 	except Exception, e:
 		errors.append(FD_PROVIDE_IP)
 
@@ -389,7 +401,6 @@
 	if not has_passwd:
 		errors.append(FD_PROVIDE_PASSWD)
 
-	fencedev.addAttribute('ipaddr', ip)
 	return errors
 
 def val_mcdata_fd(form, fencedev):
@@ -399,6 +410,7 @@
 		ip = form['ipaddr'].strip()
 		if not ip:
 			raise Exception, 'blank'
+		fencedev.addAttribute('ipaddr', ip)
 	except Exception, e:
 		errors.append(FD_PROVIDE_IP)
 
@@ -406,6 +418,7 @@
 		log = form['login'].strip()
 		if not log:
 			raise Exception, 'blank'
+		fencedev.addAttribute('login', log)
 	except Exception, e:
 		errors.append(FD_PROVIDE_LOGIN)
 
@@ -437,8 +450,6 @@
 	if not has_passwd:
 		errors.append(FD_PROVIDE_PASSWD)
 
-	fencedev.addAttribute('ipaddr', ip)
-	fencedev.addAttribute('login', log)
 	return errors
 
 def val_gnbd_fd(form, fencedev):
@@ -448,10 +459,10 @@
 		server = form['servers'].strip()
 		if not server:
 			raise Exception, 'blank'
+		fencedev.addAttribute('servers', server)
 	except Exception, e:
 		errors.append(FD_PROVIDE_SERVER)
 
-	fencedev.addAttribute('servers', server)
 	return errors
 
 def val_egenera_fd(form, fencedev):
@@ -461,10 +472,10 @@
 		cserver = form['cserver'].strip()
 		if not cserver:
 			raise Exception, 'blank'
+		fencedev.addAttribute('cserver', cserver)
 	except Exception, e:
 		errors.append(FD_PROVIDE_CSERVER)
 
-	fencedev.addAttribute('cserver', cserver)
 	return errors
 
 def val_sanbox2_fd(form, fencedev):
@@ -474,6 +485,7 @@
 		ip = form['ipaddr'].strip()
 		if not ip:
 			raise Exception, 'blank'
+		fencedev.addAttribute('ipaddr', ip)
 	except Exception, e:
 		errors.append(FD_PROVIDE_IP)
 
@@ -481,6 +493,7 @@
 		log = form['login'].strip()
 		if not log:
 			raise Exception, 'blank'
+		fencedev.addAttribute('login', log)
 	except Exception, e:
 		errors.append(FD_PROVIDE_LOGIN)
 
@@ -512,8 +525,6 @@
 	if not has_passwd:
 		errors.append(FD_PROVIDE_PASSWD)
 
-	fencedev.addAttribute('ipaddr', ip)
-	fencedev.addAttribute('login', log)
 	return errors
 
 def val_bladecenter_fd(form, fencedev):
@@ -523,6 +534,7 @@
 		ip = form['ipaddr'].strip()
 		if not ip:
 			raise Exception, 'blank'
+		fencedev.addAttribute('ipaddr', ip)
 	except Exception, e:
 		errors.append(FD_PROVIDE_IP)
 
@@ -530,6 +542,7 @@
 		log = form['login'].strip()
 		if not log:
 			raise Exception, 'blank'
+		fencedev.addAttribute('login', log)
 	except Exception, e:
 		errors.append(FD_PROVIDE_LOGIN)
 
@@ -561,8 +574,6 @@
 	if not has_passwd:
 		errors.append(FD_PROVIDE_PASSWD)
 
-	fencedev.addAttribute('ipaddr', ip)
-	fencedev.addAttribute('login', log)
 	return errors
 
 def val_bullpap_fd(form, fencedev):
@@ -572,6 +583,7 @@
 		ip = form['ipaddr'].strip()
 		if not ip:
 			raise Exception, 'blank'
+		fencedev.addAttribute('ipaddr', ip)
 	except Exception, e:
 		errors.append(FD_PROVIDE_IP)
 
@@ -579,6 +591,7 @@
 		log = form['login'].strip()
 		if not log:
 			raise Exception, 'blank'
+		fencedev.addAttribute('login', log)
 	except Exception, e:
 		errors.append(FD_PROVIDE_LOGIN)
 
@@ -610,8 +623,6 @@
 	if not has_passwd:
 		errors.append(FD_PROVIDE_PASSWD)
 
-	fencedev.addAttribute('ipaddr', ip)
-	fencedev.addAttribute('login', log)
 	return errors
 
 def val_noop_fd(dummy, _dummy):
@@ -626,6 +637,7 @@
 		hostname = form['hostname'].strip()
 		if not hostname:
 			raise Exception, 'blank'
+		fencedev.addAttribute('hostname', hostname)
 	except Exception, e:
 		errors.append(FD_PROVIDE_HOSTNAME)
 
@@ -633,6 +645,7 @@
 		log = form['login'].strip()
 		if not log:
 			raise Exception, 'blank'
+		fencedev.addAttribute('login', log)
 	except Exception, e:
 		errors.append(FD_PROVIDE_LOGIN)
 
@@ -664,8 +677,6 @@
 	if not has_passwd:
 		errors.append(FD_PROVIDE_PASSWD)
 
-	fencedev.addAttribute('hostname', hostname)
-	fencedev.addAttribute('login', log)
 	return errors
 
 def val_drac_fd(form, fencedev):
@@ -675,6 +686,7 @@
 		ip = form['ipaddr'].strip()
 		if not ip:
 			raise Exception, 'blank'
+		fencedev.addAttribute('ipaddr', ip)
 	except Exception, e:
 		errors.append(FD_PROVIDE_IP)
 
@@ -682,6 +694,7 @@
 		log = form['login'].strip()
 		if not log:
 			raise Exception, 'blank'
+		fencedev.addAttribute('login', log)
 	except Exception, e:
 		errors.append(FD_PROVIDE_LOGIN)
 
@@ -713,8 +726,6 @@
 	if not has_passwd:
 		errors.append(FD_PROVIDE_PASSWD)
 
-	fencedev.addAttribute('ipaddr', ip)
-	fencedev.addAttribute('login', log)
 	return errors
 
 def val_rps10_fd(form, fencedev):
@@ -724,6 +735,7 @@
 		device = form['device'].strip()
 		if not device:
 			raise Exception, 'blank'
+		fencedev.addAttribute('device', device)
 	except Exception, e:
 		errors.append(FD_PROVIDE_DEVICE)
 
@@ -731,11 +743,10 @@
 		port = form['port'].strip()
 		if not port:
 			raise Exception, 'blank'
+		fencedev.addAttribute('port', port)
 	except Exception, e:
 		errors.append(FD_PROVIDE_PORT)
 
-	fencedev.addAttribute('device', device)
-	fencedev.addAttribute('port', port)
 	return errors
 
 def val_ipmilan_fd(form, fencedev):
@@ -745,6 +756,7 @@
 		ip = form['ipaddr'].strip()
 		if not ip:
 			raise Exception, 'blank'
+		fencedev.addAttribute('ipaddr', ip)
 	except Exception, e:
 		errors.append(FD_PROVIDE_IP)
 
@@ -752,6 +764,7 @@
 		log = form['login'].strip()
 		if not log:
 			raise Exception, 'blank'
+		fencedev.addAttribute('login', log)
 	except Exception, e:
 		errors.append(FD_PROVIDE_LOGIN)
 
@@ -805,8 +818,6 @@
 	except Exception, e:
 		fencedev.removeAttribute('lanplus')
 
-	fencedev.addAttribute('ipaddr', ip)
-	fencedev.addAttribute('login', log)
 	return errors
 
 def val_ilo_fd(form, fencedev):
@@ -816,6 +827,7 @@
 		hostname = form['hostname'].strip()
 		if not hostname:
 			raise Exception, 'blank'
+		fencedev.addAttribute('hostname', hostname)
 	except Exception, e:
 		errors.append(FD_PROVIDE_HOSTNAME)
 
@@ -823,6 +835,7 @@
 		log = form['login'].strip()
 		if not log:
 			raise Exception, 'blank'
+		fencedev.addAttribute('login', log)
 	except Exception, e:
 		errors.append(FD_PROVIDE_LOGIN)
 
@@ -854,8 +867,6 @@
 	if not has_passwd:
 		errors.append(FD_PROVIDE_PASSWD)
 
-	fencedev.addAttribute('hostname', hostname)
-	fencedev.addAttribute('login', log)
 	return errors
 
 FD_VALIDATE = {
@@ -919,10 +930,15 @@
 		if len(ret) < 1 and name_change is True:
 			try:
 				model.rectifyNewFencedevicenameWithFences(old_fence_name, fence_name)
-			except:
+			except Exception, e:
+				if LUCI_DEBUG_MODE is True:
+					luci_log.debug_verbose('vfd0: %s %r %s' \
+						% (fence_agent, e, str(e)))
 				return [ FD_NEW_FAIL % fence_agent ]
 		return ret
-	except:
+	except Exception, e:
+		if LUCI_DEBUG_MODE is True:
+			luci_log.debug_verbose('vfd1: %s %r %s' % (fence_agent, e, str(e)))
 		return [ FD_NEW_FAIL % fence_agent ]
 
 # Validation Methods for Fence Instances
@@ -934,6 +950,7 @@
 		port = form['port'].strip()
 		if not port:
 			raise Exception, 'blank'
+		fenceinst.addAttribute('port', port)
 	except Exception, e:
 		errors.append(FI_PROVIDE_PORT)
 
@@ -948,7 +965,6 @@
 	except Exception, e:
 		errors.append(FI_PROVIDE_SWITCH)
 
-	fenceinst.addAttribute('port', port)
 	return errors
 
 def val_wti_fi(form, fenceinst):
@@ -958,10 +974,10 @@
 		port = form['port'].strip()
 		if not port:
 			raise Exception, 'blank'
+		fenceinst.addAttribute('port', port)
 	except Exception, e:
 		errors.append(FI_PROVIDE_PORT)
 
-	fenceinst.addAttribute('port', port)
 	return errors
 
 def val_brocade_fi(form, fenceinst):
@@ -971,10 +987,10 @@
 		port = form['port'].strip()
 		if not port:
 			raise Exception, 'blank'
+		fenceinst.addAttribute('port', port)
 	except Exception, e:
 		errors.append(FI_PROVIDE_PORT)
 
-	fenceinst.addAttribute('port', port)
 	return errors
 
 def val_vixel_fi(form, fenceinst):
@@ -984,10 +1000,10 @@
 		port = form['port'].strip()
 		if not port:
 			raise Exception, 'blank'
+		fenceinst.addAttribute('port', port)
 	except Exception, e:
 		errors.append(FI_PROVIDE_PORT)
 
-	fenceinst.addAttribute('port', port)
 	return errors
 
 def val_gnbd_fi(form, fenceinst):
@@ -997,10 +1013,10 @@
 		ip = form['ipaddress'].strip()
 		if not ip:
 			raise Exception, 'blank'
+		fenceinst.addAttribute('ipaddress', ip)
 	except Exception, e:
 		errors.append(FI_PROVIDE_IPADDRESS)
 
-	fenceinst.addAttribute('ipaddress', ip)
 	return errors
 
 def val_sanbox2_fi(form, fenceinst):
@@ -1010,10 +1026,10 @@
 		port = form['port'].strip()
 		if not port:
 			raise Exception, 'blank'
+		fenceinst.addAttribute('port', port)
 	except Exception, e:
 		errors.append(FI_PROVIDE_PORT)
 
-	fenceinst.addAttribute('port', port)
 	return errors
 
 def val_bladecenter_fi(form, fenceinst):
@@ -1023,10 +1039,10 @@
 		blade = form['blade'].strip()
 		if not blade:
 			raise Exception, 'blank'
+		fenceinst.addAttribute('blade', blade)
 	except Exception, e:
 		errors.append(FI_PROVIDE_BLADE)
 
-	fenceinst.addAttribute('blade', blade)
 	return errors
 
 def val_mcdata_fi(form, fenceinst):
@@ -1036,10 +1052,10 @@
 		port = form['port'].strip()
 		if not port:
 			raise Exception, 'blank'
+		fenceinst.addAttribute('port', port)
 	except Exception, e:
 		errors.append(FI_PROVIDE_PORT)
 
-	fenceinst.addAttribute('port', port)
 	return errors
 
 def val_egenera_fi(form, fenceinst):
@@ -1049,6 +1065,7 @@
 		lpan = form['lpan'].strip()
 		if not lpan:
 			raise Exception, 'blank'
+		fenceinst.addAttribute('lpan', lpan)
 	except Exception, e:
 		errors.append(FI_PROVIDE_ELPAN)
 
@@ -1056,11 +1073,10 @@
 		pserver = form['pserver'].strip()
 		if not pserver:
 			raise Exception, 'blank'
+		fenceinst.addAttribute('pserver', pserver)
 	except Exception, e:
 		errors.append(FI_PROVIDE_ELPAN)
 
-	fenceinst.addAttribute('lpan', lpan)
-	fenceinst.addAttribute('pserver', pserver)
 	return errors
 
 def val_bullpap_fi(form, fenceinst):
@@ -1070,10 +1086,10 @@
 		domain = form['domain'].strip()
 		if not domain:
 			raise Exception, 'blank'
+		fenceinst.addAttribute('domain', domain)
 	except Exception, e:
 		errors.append(FI_PROVIDE_DOMAIN)
 
-	fenceinst.addAttribute('domain', domain)
 	return errors
 
 def val_xvm_fi(form, fenceinst):
@@ -1083,10 +1099,10 @@
 		domain = form['domain'].strip()
 		if not domain:
 			raise Exception, 'blank'
+		fenceinst.addAttribute('domain', domain)
 	except Exception, e:
 		errors.append(FI_PROVIDE_DOMAIN)
 
-	fenceinst.addAttribute('domain', domain)
 	return errors
 
 def val_scsi_fi(form, fenceinst):
@@ -1096,10 +1112,10 @@
 		nodename = form['nodename'].strip()
 		if not nodename:
 			raise Exception, 'blank'
+		fenceinst.addAttribute('nodename', nodename)
 	except Exception, e:
 		errors.append(FI_PROVIDE_NODENAME)
 
-	fenceinst.addAttribute('nodename', nodename)
 	return errors
 
 def val_noop_fi(dummy, _dummy):
@@ -1141,6 +1157,8 @@
 		if len(ret) > 0:
 			return (FD_VAL_FAIL, ret)
 	except Exception, e:
+		if LUCI_DEBUG_MODE is True:
+			luci_log.debug_verbose('vfi0: %s: %r %s' % (fence_agent, e, str(e)))
 		return (FD_VAL_FAIL, [ FI_NEW_FAIL % fence_agent ])
 
 	return (FD_VAL_SUCCESS, fenceinst)
--- conga/luci/site/luci/Extensions/LuciClusterInfo.py	2007/07/03 17:05:59	1.5
+++ conga/luci/site/luci/Extensions/LuciClusterInfo.py	2007/07/12 15:44:43	1.6
@@ -1525,6 +1525,7 @@
 		model = ModelBuilder(0, None, None, cluster_conf_node)
 		if not model:
 			raise Exception, 'ModelBuilder() returned None'
+		model.setIsVirtualized(isVirtualized)
 	except Exception, e:
 		try:
 			if LUCI_DEBUG_MODE is True:
@@ -1534,7 +1535,6 @@
 				luci_log.debug_verbose('GMB1: ModelBuilder failed')
 		return None
 
-	model.setIsVirtualized(isVirtualized)
 	return model
 
 def getModelForCluster(self, clustername):
@@ -1550,12 +1550,11 @@
 		model = getModelBuilder(None, rc, rc.dom0())
 		if not model:
 			raise Exception, 'model is none'
+		return model
 	except Exception, e:
 		if LUCI_DEBUG_MODE is True:
 			luci_log.debug_verbose('GMFC1: unable to get model builder for %s: %r %s' % (clustername, e, str(e)))
-		return None
-
-	return model
+	return None
 
 def getClusterOS(self, rc):
 	from HelperFunctions import resolveOSType
--- conga/luci/site/luci/Extensions/PropsObject.py	2007/07/03 17:05:59	1.4
+++ conga/luci/site/luci/Extensions/PropsObject.py	2007/07/12 15:44:43	1.5
@@ -26,7 +26,7 @@
         return self.__vars
 
     def export_xml(self, doc, parent_node):
-        props = doc.createElement(str(PROPS_TAG))
+        props = doc.createElement(PROPS_TAG)
         parent_node.appendChild(props)
         for var in self.__vars:
             props.appendChild(self.__vars[var].export_xml(doc))
@@ -36,7 +36,7 @@
         props = None
         for node in parent_node.childNodes:
             if node.nodeType == ELEMENT_NODE:
-                if node.nodeName == str(PROPS_TAG):
+                if node.nodeName == PROPS_TAG:
                     props = node
         if props is None:
             return self
--- conga/luci/site/luci/Extensions/homebase_adapters.py	2007/06/25 16:03:39	1.51
+++ conga/luci/site/luci/Extensions/homebase_adapters.py	2007/07/12 15:44:43	1.52
@@ -39,7 +39,7 @@
 	errors = list()
 	messages = list()
 
-	if '__SYSTEM' in request.form:
+	if request.form.has_key('__SYSTEM'):
 		system_names = request.form['__SYSTEM']
 		for i in system_names:
 			if not i:
@@ -50,7 +50,7 @@
 			else:
 				messages.append('Removed storage system "%s" successfully' % i)
 
-	if '__CLUSTER' in request.form:
+	if request.form.has_key('__CLUSTER'):
 		cluster_names = request.form['__CLUSTER']
 		for i in cluster_names:
 			if not i:
@@ -70,9 +70,8 @@
 	if not request.form.has_key('deluserId'):
 		return (False, { 'errors': [ 'No User ID given' ] })
 
-	userId = request.form['deluserId']
-
 	try:
+		userId = request.form['deluserId'].strip()
 		user = self.portal_membership.getMemberById(userId)
 		if not user:
 			raise Exception, 'user %s does not exist' % userId
@@ -117,8 +116,10 @@
 
 	if not request.form.has_key('newUserName'):
 		return (False, { 'errors': [ 'No user name given' ] })
+
 	if not request.form.has_key('newPassword'):
 		return (False, { 'errors': [ 'No password given' ] })
+
 	if not request.form.has_key('newPasswordConfirm'):
 		return (False, { 'errors': [ 'You didn\'t confirm the password' ] })
 
@@ -133,12 +134,21 @@
 	if passwd != pwconfirm:
 		return (False, { 'errors': [ 'The passwords given do not match' ]})
 
+	user_props = {
+		'username': user,
+		'password': passwd,
+		'confirm': passwd,
+		'roles': [ 'Member' ],
+		'domains': [],
+		'email': '%s conga example com' % user
+	}
+
 	try:
-		self.portal_registration.addMember(user, passwd, properties = { 'username': user, 'password': passwd, 'confirm': passwd, 'roles': [ 'Member' ], 'domains': [], 'email': '%s conga example com' % user })
+		self.portal_registration.addMember(user, passwd, properties=user_props)
 	except Exception, e:
 		if LUCI_DEBUG_MODE is True:
 			luci_log.debug_verbose('VAU0: %s: %r %s' % (user, e, str(e)))
-		return (False, { 'errors': [ 'Unable to add new user "%s"' % user ] })
+		return (False, { 'errors': [ 'Unable to add new user "%s": %s ' % (user, str(e)) ] })
 
 	if not self.portal_membership.getMemberById(user):
 		return (False, { 'errors': [ 'Unable to add new user "%s"' % user ] })
@@ -542,11 +552,13 @@
 	except:
 		pass_num = 1
 
-	add_cluster = { 'name': cluster_name,
-					'pass': pass_num,
-					'cluster_os': cluster_os,
-					'identical_passwds': same_node_passwds,
-					'check_certs': check_certs }
+	add_cluster = {
+		'name': cluster_name,
+		'pass': pass_num,
+		'cluster_os': cluster_os,
+		'identical_passwds': same_node_passwds,
+		'check_certs': check_certs
+	}
 
 	system_list, incomplete, new_errors, messages = parseHostForm(request, check_certs)
 	errors.extend(new_errors)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]