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

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



CVSROOT:	/cvs/cluster
Module name:	conga
Branch: 	RHEL4
Changes by:	rmccabe sourceware org	2007-02-12 23:28:17

Modified files:
	luci/cluster   : form-macros validate_fence.js 
	luci/site/luci/Extensions: FenceHandler.py 

Log message:
	Support the 'passwd_script' fence device attribute

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/form-macros.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.176.2.8&r2=1.176.2.9
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/validate_fence.js.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.3.2.1&r2=1.3.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/FenceHandler.py.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.17&r2=1.17.2.1

--- conga/luci/cluster/form-macros	2007/02/09 20:33:21	1.176.2.8
+++ conga/luci/cluster/form-macros	2007/02/12 23:28:15	1.176.2.9
@@ -651,7 +651,7 @@
 								<a class="cluster_help" href="javascript:popup_window('/luci/doc/config_rhel5#rrp_mode', 55, 65);">Redundant Ring Protocol Mode</a>
 							</td>
 							<td class="systemsTable">
-								<select name="text" name="rrp_mode">
+								<select type="text" name="rrp_mode">
 									<option value="none">
 										None
 									</option>
@@ -1489,6 +1489,17 @@
 							value nothing" />
 				</td>
 			</tr>
+			<tr>
+				<td>
+					<span title="Full path to a script to generate fence password">Password Script (optional)</span>
+				</td>
+				<td>
+					<input type="text" name="passwd_script"
+						tal:attributes="
+							disabled cur_fencedev/isShared | nothing;
+							value cur_fencedev/passwd_script | nothing" />
+				</td>
+			</tr>
 		</table>
 
 		<tal:block tal:condition="exists: cur_fencedev">
@@ -1547,6 +1558,17 @@
 							value nothing" />
 				</td>
 			</tr>
+			<tr>
+				<td>
+					<span title="Full path to a script to generate fence password">Password Script (optional)</span>
+				</td>
+				<td>
+					<input type="text" name="passwd_script"
+						tal:attributes="
+							disabled cur_fencedev/isShared | nothing;
+							value cur_fencedev/passwd_script | nothing" />
+				</td>
+			</tr>
 		</table>
 
 		<tal:block tal:condition="exists: cur_fencedev">
@@ -1596,6 +1618,17 @@
 							value nothing" />
 				</td>
 			</tr>
+			<tr>
+				<td>
+					<span title="Full path to a script to generate fence password">Password Script (optional)</span>
+				</td>
+				<td>
+					<input type="text" name="passwd_script"
+						tal:attributes="
+							disabled cur_fencedev/isShared | nothing;
+							value cur_fencedev/passwd_script | nothing" />
+				</td>
+			</tr>
 		</table>
 
 		<tal:block tal:condition="exists: cur_fencedev">
@@ -1646,6 +1679,17 @@
 						tal:attributes="value nothing" />
 				</td>
 			</tr>
+			<tr>
+				<td>
+					<span title="Full path to a script to generate fence password">Password Script (optional)</span>
+				</td>
+				<td>
+					<input type="text" name="passwd_script"
+						tal:attributes="
+							disabled cur_fencedev/isShared | nothing;
+							value cur_fencedev/passwd_script | nothing" />
+				</td>
+			</tr>
 		</table>
 
 		<tal:block tal:condition="exists: cur_fencedev">
@@ -1694,6 +1738,18 @@
 					<input name="passwd" type="password" autocomplete="off"
 						tal:attributes="value nothing" />
 				</td>
+			</tr>
+			<tr>
+				<td>
+					<span title="Full path to a script to generate fence password">Password Script (optional)</span>
+				</td>
+				<td>
+					<input type="text" name="passwd_script"
+						tal:attributes="
+							disabled cur_fencedev/isShared | nothing;
+							value cur_fencedev/passwd_script | nothing" />
+				</td>
+			</tr>
 		</table>
 
 		<tal:block tal:condition="exists: cur_fencedev">
@@ -1743,6 +1799,17 @@
 						tal:attributes="value nothing" />
 				</td>
 			</tr>
+			<tr>
+				<td>
+					<span title="Full path to a script to generate fence password">Password Script (optional)</span>
+				</td>
+				<td>
+					<input type="text" name="passwd_script"
+						tal:attributes="
+							disabled cur_fencedev/isShared | nothing;
+							value cur_fencedev/passwd_script | nothing" />
+				</td>
+			</tr>
 		</table>
 
 		<tal:block tal:condition="exists: cur_fencedev">
@@ -1800,6 +1867,17 @@
 							value nothing" />
 				</td>
 			</tr>
+			<tr>
+				<td>
+					<span title="Full path to a script to generate fence password">Password Script (optional)</span>
+				</td>
+				<td>
+					<input type="text" name="passwd_script"
+						tal:attributes="
+							disabled cur_fencedev/isShared | nothing;
+							value cur_fencedev/passwd_script | nothing" />
+				</td>
+			</tr>
 		</table>
 
 		<tal:block tal:condition="exists: cur_fencedev">
@@ -1858,6 +1936,17 @@
 							value nothing" />
 				</td>
 			</tr>
+			<tr>
+				<td>
+					<span title="Full path to a script to generate fence password">Password Script (optional)</span>
+				</td>
+				<td>
+					<input type="text" name="passwd_script"
+						tal:attributes="
+							disabled cur_fencedev/isShared | nothing;
+							value cur_fencedev/passwd_script | nothing" />
+				</td>
+			</tr>
 		</table>
 
 		<tal:block tal:condition="exists: cur_fencedev">
@@ -1907,6 +1996,17 @@
 							value nothing" />
 				</td>
 			</tr>
+			<tr>
+				<td>
+					<span title="Full path to a script to generate fence password">Password Script (optional)</span>
+				</td>
+				<td>
+					<input type="text" name="passwd_script"
+						tal:attributes="
+							disabled cur_fencedev/isShared | nothing;
+							value cur_fencedev/passwd_script | nothing" />
+				</td>
+			</tr>
 		</table>
 
 		<tal:block tal:condition="exists: cur_fencedev">
@@ -2046,6 +2146,17 @@
 						tal:attributes="value nothing" />
 				</td>
 			</tr>
+			<tr>
+				<td>
+					<span title="Full path to a script to generate fence password">Password Script (optional)</span>
+				</td>
+				<td>
+					<input type="text" name="passwd_script"
+						tal:attributes="
+							disabled cur_fencedev/isShared | nothing;
+							value cur_fencedev/passwd_script | nothing" />
+				</td>
+			</tr>
 		</table>
 
 		<tal:block tal:condition="exists: cur_fencedev">
@@ -2104,6 +2215,17 @@
 							value nothing" />
 				</td>
 			</tr>
+			<tr>
+				<td>
+					<span title="Full path to a script to generate fence password">Password Script (optional)</span>
+				</td>
+				<td>
+					<input type="text" name="passwd_script"
+						tal:attributes="
+							disabled cur_fencedev/isShared | nothing;
+							value cur_fencedev/passwd_script | nothing" />
+				</td>
+			</tr>
 		</table>
 
 		<tal:block tal:condition="exists: cur_fencedev">
@@ -2259,6 +2381,17 @@
 				</td>
 			</tr>
 			<tr>
+				<td>
+					<span title="Full path to a script to generate fence password">Password Script (optional)</span>
+				</td>
+				<td>
+					<input type="text" name="passwd_script"
+						tal:attributes="
+							disabled cur_fencedev/isShared | nothing;
+							value cur_fencedev/passwd_script | nothing" />
+				</td>
+			</tr>
+			<tr>
 				<td>Authentication Type</td>
 				<td>
 					<input name="auth" type="text" title="Options are to leave blank for none, password, or md5"
@@ -4855,8 +4988,6 @@
 			<input type="hidden" name="pagetype" value="54" />
 			<input type="hidden" name="clustername"
 				tal:attributes="value request/clustername" />
-			<input type="hidden" name="orig_name"
-				tal:attributes="value request/fencename"/>
 			<input type="hidden" name="fencename"
 				tal:attributes="value request/fencename" />
 
--- conga/luci/cluster/validate_fence.js	2007/02/09 18:32:03	1.3.2.1
+++ conga/luci/cluster/validate_fence.js	2007/02/12 23:28:15	1.3.2.2
@@ -13,27 +13,27 @@
 fence_inst_validator['xvm'] = [ 'domain' ];
 
 var fence_validator = new Array();
-fence_validator['apc'] = [ 'ipaddr', 'login', 'passwd' ];
-fence_validator['bladecenter'] = [ 'ipaddr', 'login', 'passwd' ];
-fence_validator['brocade'] = [ 'ipaddr', 'login', 'passwd' ];
-fence_validator['bullpap'] = [ 'ipaddr', 'login', 'passwd' ];
-fence_validator['drac'] = [ 'ipaddr', 'login', 'passwd' ];
+fence_validator['apc'] = [ 'ipaddr', 'login', 'passwd', 'passwd_script' ];
+fence_validator['bladecenter'] = [ 'ipaddr', 'login', 'passwd', 'passwd_script' ];
+fence_validator['brocade'] = [ 'ipaddr', 'login', 'passwd', 'passwd_script' ];
+fence_validator['bullpap'] = [ 'ipaddr', 'login', 'passwd', 'passwd_script' ];
+fence_validator['drac'] = [ 'ipaddr', 'login', 'passwd', 'passwd_script' ];
 fence_validator['egenera'] = [ 'cserver' ];
 fence_validator['gnbd'] = [ 'servers' ];
-fence_validator['ilo'] = [ 'hostname', 'login', 'passwd' ];
-fence_validator['ipmilan'] = [ 'ipaddr', 'login', 'passwd', 'lanplus', 'auth' ];
+fence_validator['ilo'] = [ 'hostname', 'login', 'passwd', 'passwd_script' ];
+fence_validator['ipmilan'] = [ 'ipaddr', 'login', 'passwd', 'passwd_script', 'lanplus', 'auth' ];
 fence_validator['manual'] = [];
-fence_validator['mcdata'] = [ 'ipaddr', 'login', 'passwd' ];
+fence_validator['mcdata'] = [ 'ipaddr', 'login', 'passwd', 'passwd_script' ];
 fence_validator['rps10'] = [ 'device', 'port'];
-fence_validator['rsa'] = [ 'hostname', 'login', 'passwd' ];
-fence_validator['sanbox2'] = [ 'ipaddr', 'login', 'passwd' ];
+fence_validator['rsa'] = [ 'hostname', 'login', 'passwd', 'passwd_script' ];
+fence_validator['sanbox2'] = [ 'ipaddr', 'login', 'passwd', 'passwd_script' ];
 fence_validator['scsi'] = [];
 fence_validator['unknown'] = [];
-fence_validator['vixel'] = [ 'ipaddr', 'passwd' ];
-fence_validator['wti'] = [ 'ipaddr', 'passwd' ];
+fence_validator['vixel'] = [ 'ipaddr', 'passwd', 'passwd_script' ];
+fence_validator['wti'] = [ 'ipaddr', 'passwd', 'passwd_script' ];
 fence_validator['xvm'] = [];
 
-function validate_field_str(form_elem) {
+function validate_field_str(form, form_elem) {
 	var errors = new Array();
 
 	if (!form_elem || str_is_blank(form_elem.value)) {
@@ -50,26 +50,33 @@
 	return (null);
 }
 
-function validate_field_passwd(form_elem) {
+function validate_field_passwd(form, form_elem) {
 	if (form_elem.disabled) {
 		clr_form_err(form_elem);
 		return (null);
 	}
-	return validate_field_str(form_elem);
+
+	var errors = validate_field_str(form, form_elem);
+	if (errors && errors.length > 0 && form.passwd_script && !str_is_blank(form.passwd_script.value))
+	{
+		clr_form_err(form_elem);
+		return (null);
+	}
+	return errors;
 }
 
 /* Very loose checking for now -- just make sure it's not blank */
-function validate_field_host(form_elem) {
-	return (validate_field_str(form_elem));
+function validate_field_host(form, form_elem) {
+	return (validate_field_str(form, form_elem));
 }
 
-function validate_field_noop(form_elem) {
+function validate_field_noop(form, form_elem) {
 	if (form_elem)
 		clr_form_err(form_elem);
 	return (null);
 }
 
-function validate_field_ipmilan_auth(form_elem) {
+function validate_field_ipmilan_auth(form, form_elem) {
 	var errors = new Array();
 
 	if (!form_elem || str_is_blank(form_elem.value))
@@ -95,6 +102,7 @@
 field_validator['cserver'] = validate_field_str;
 field_validator['device'] = validate_field_str;
 field_validator['port'] = validate_field_str;
+field_validator['passwd_script'] = validate_field_noop;
 
 /* IPMI fence device */
 field_validator['lanplus'] = validate_field_noop;
@@ -138,7 +146,7 @@
 
 	for (var i = 0 ; i < fields.length ; i++) {
 		var field_name = fields[i];
-		var err = field_validator[field_name](form[field_name]);
+		var err = field_validator[field_name](form, form[field_name]);
 		if (err)
 			errors = errors.concat(err);
 	}
--- conga/luci/site/luci/Extensions/FenceHandler.py	2007/01/25 19:55:09	1.17
+++ conga/luci/site/luci/Extensions/FenceHandler.py	2007/02/12 23:28:16	1.17.2.1
@@ -221,16 +221,36 @@
 	except Exception, e:
 		errors.append(FD_PROVIDE_LOGIN)
 
+	has_passwd = False
 	try:
 		pwd = form['passwd'].strip()
 		if not pwd:
 			raise Exception, 'blank'
+		fencedev.addAttribute('passwd', pwd)
+		has_passwd = True
 	except Exception, e:
+		try:
+			fencedev.removeAttribute('passwd')
+		except:
+			pass
+
+	try:
+		pwd_script = form['passwd_script'].strip()
+		if not pwd_script:
+			raise Exception, 'blank'
+		fencedev.addAttribute('passwd_script', pwd_script)
+		has_passwd = True
+	except Exception, e:
+		try:
+			fencedev.removeAttribute('passwd_script')
+		except:
+			pass
+
+	if not has_passwd:
 		errors.append(FD_PROVIDE_PASSWD)
 
 	fencedev.addAttribute('ipaddr', ip)
 	fencedev.addAttribute('login', log)
-	fencedev.addAttribute('passwd', pwd)
 	return errors
 
 def val_wti_fd(form, fencedev):
@@ -243,15 +263,35 @@
 	except Exception, e:
 		errors.append(FD_PROVIDE_IP)
 
+	has_passwd = False
 	try:
 		pwd = form['passwd'].strip()
 		if not pwd:
 			raise Exception, 'blank'
+		fencedev.addAttribute('passwd', pwd)
+		has_passwd = True
+	except Exception, e:
+		try:
+			fencedev.removeAttribute('passwd')
+		except:
+			pass
+
+	try:
+		pwd_script = form['passwd_script'].strip()
+		if not pwd_script:
+			raise Exception, 'blank'
+		fencedev.addAttribute('passwd_script', pwd_script)
+		has_passwd = True
 	except Exception, e:
+		try:
+			fencedev.removeAttribute('passwd_script')
+		except:
+			pass
+
+	if not has_passwd:
 		errors.append(FD_PROVIDE_PASSWD)
 
 	fencedev.addAttribute('ipaddr', ip)
-	fencedev.addAttribute('passwd', pwd)
 	return errors
 
 def val_brocade_fd(form, fencedev):
@@ -271,16 +311,36 @@
 	except Exception, e:
 		errors.append(FD_PROVIDE_LOGIN)
 
+	has_passwd = False
 	try:
 		pwd = form['passwd'].strip()
 		if not pwd:
 			raise Exception, 'blank'
+		fencedev.addAttribute('passwd', pwd)
+		has_passwd = True
 	except Exception, e:
+		try:
+			fencedev.removeAttribute('passwd')
+		except:
+			pass
+
+	try:
+		pwd_script = form['passwd_script'].strip()
+		if not pwd_script:
+			raise Exception, 'blank'
+		fencedev.addAttribute('passwd_script', pwd_script)
+		has_passwd = True
+	except Exception, e:
+		try:
+			fencedev.removeAttribute('passwd_script')
+		except:
+			pass
+
+	if not has_passwd:
 		errors.append(FD_PROVIDE_PASSWD)
 
 	fencedev.addAttribute('ipaddr', ip)
 	fencedev.addAttribute('login', log)
-	fencedev.addAttribute('passwd', pwd)
 	return errors
 
 def val_vixel_fd(form, fencedev):
@@ -293,15 +353,35 @@
 	except Exception, e:
 		errors.append(FD_PROVIDE_IP)
 
+	has_passwd = False
 	try:
 		pwd = form['passwd'].strip()
 		if not pwd:
 			raise Exception, 'blank'
+		fencedev.addAttribute('passwd', pwd)
+		has_passwd = True
 	except Exception, e:
+		try:
+			fencedev.removeAttribute('passwd')
+		except:
+			pass
+
+	try:
+		pwd_script = form['passwd_script'].strip()
+		if not pwd_script:
+			raise Exception, 'blank'
+		fencedev.addAttribute('passwd_script', pwd_script)
+		has_passwd = True
+	except Exception, e:
+		try:
+			fencedev.removeAttribute('passwd_script')
+		except:
+			pass
+
+	if not has_passwd:
 		errors.append(FD_PROVIDE_PASSWD)
 
 	fencedev.addAttribute('ipaddr', ip)
-	fencedev.addAttribute('passwd', pwd)
 	return errors
 
 def val_mcdata_fd(form, fencedev):
@@ -321,16 +401,36 @@
 	except Exception, e:
 		errors.append(FD_PROVIDE_LOGIN)
 
+	has_passwd = False
 	try:
 		pwd = form['passwd'].strip()
 		if not pwd:
 			raise Exception, 'blank'
+		fencedev.addAttribute('passwd', pwd)
+		has_passwd = True
+	except Exception, e:
+		try:
+			fencedev.removeAttribute('passwd')
+		except:
+			pass
+
+	try:
+		pwd_script = form['passwd_script'].strip()
+		if not pwd_script:
+			raise Exception, 'blank'
+		fencedev.addAttribute('passwd_script', pwd_script)
+		has_passwd = True
 	except Exception, e:
+		try:
+			fencedev.removeAttribute('passwd_script')
+		except:
+			pass
+
+	if not has_passwd:
 		errors.append(FD_PROVIDE_PASSWD)
 
 	fencedev.addAttribute('ipaddr', ip)
 	fencedev.addAttribute('login', log)
-	fencedev.addAttribute('passwd', pwd)
 	return errors
 
 def val_gnbd_fd(form, fencedev):
@@ -376,16 +476,36 @@
 	except Exception, e:
 		errors.append(FD_PROVIDE_LOGIN)
 
+	has_passwd = False
 	try:
 		pwd = form['passwd'].strip()
 		if not pwd:
 			raise Exception, 'blank'
+		fencedev.addAttribute('passwd', pwd)
+		has_passwd = True
+	except Exception, e:
+		try:
+			fencedev.removeAttribute('passwd')
+		except:
+			pass
+
+	try:
+		pwd_script = form['passwd_script'].strip()
+		if not pwd_script:
+			raise Exception, 'blank'
+		fencedev.addAttribute('passwd_script', pwd_script)
+		has_passwd = True
 	except Exception, e:
+		try:
+			fencedev.removeAttribute('passwd_script')
+		except:
+			pass
+
+	if not has_passwd:
 		errors.append(FD_PROVIDE_PASSWD)
 
 	fencedev.addAttribute('ipaddr', ip)
 	fencedev.addAttribute('login', log)
-	fencedev.addAttribute('passwd', pwd)
 	return errors
 
 def val_bladecenter_fd(form, fencedev):
@@ -405,16 +525,36 @@
 	except Exception, e:
 		errors.append(FD_PROVIDE_LOGIN)
 
+	has_passwd = False
 	try:
 		pwd = form['passwd'].strip()
 		if not pwd:
 			raise Exception, 'blank'
+		fencedev.addAttribute('passwd', pwd)
+		has_passwd = True
+	except Exception, e:
+		try:
+			fencedev.removeAttribute('passwd')
+		except:
+			pass
+
+	try:
+		pwd_script = form['passwd_script'].strip()
+		if not pwd_script:
+			raise Exception, 'blank'
+		fencedev.addAttribute('passwd_script', pwd_script)
+		has_passwd = True
 	except Exception, e:
+		try:
+			fencedev.removeAttribute('passwd_script')
+		except:
+			pass
+
+	if not has_passwd:
 		errors.append(FD_PROVIDE_PASSWD)
 
 	fencedev.addAttribute('ipaddr', ip)
 	fencedev.addAttribute('login', log)
-	fencedev.addAttribute('passwd', pwd)
 	return errors
 
 def val_bullpap_fd(form, fencedev):
@@ -434,16 +574,36 @@
 	except Exception, e:
 		errors.append(FD_PROVIDE_LOGIN)
 
+	has_passwd = False
 	try:
 		pwd = form['passwd'].strip()
 		if not pwd:
 			raise Exception, 'blank'
+		fencedev.addAttribute('passwd', pwd)
+		has_passwd = True
+	except Exception, e:
+		try:
+			fencedev.removeAttribute('passwd')
+		except:
+			pass
+
+	try:
+		pwd_script = form['passwd_script'].strip()
+		if not pwd_script:
+			raise Exception, 'blank'
+		fencedev.addAttribute('passwd_script', pwd_script)
+		has_passwd = True
 	except Exception, e:
+		try:
+			fencedev.removeAttribute('passwd_script')
+		except:
+			pass
+
+	if not has_passwd:
 		errors.append(FD_PROVIDE_PASSWD)
 
 	fencedev.addAttribute('ipaddr', ip)
 	fencedev.addAttribute('login', log)
-	fencedev.addAttribute('passwd', pwd)
 	return errors
 
 def val_noop_fd(dummy, _dummy):
@@ -468,16 +628,36 @@
 	except Exception, e:
 		errors.append(FD_PROVIDE_LOGIN)
 
+	has_passwd = False
 	try:
 		pwd = form['passwd'].strip()
 		if not pwd:
 			raise Exception, 'blank'
+		fencedev.addAttribute('passwd', pwd)
+		has_passwd = True
 	except Exception, e:
+		try:
+			fencedev.removeAttribute('passwd')
+		except:
+			pass
+
+	try:
+		pwd_script = form['passwd_script'].strip()
+		if not pwd_script:
+			raise Exception, 'blank'
+		fencedev.addAttribute('passwd_script', pwd_script)
+		has_passwd = True
+	except Exception, e:
+		try:
+			fencedev.removeAttribute('passwd_script')
+		except:
+			pass
+
+	if not has_passwd:
 		errors.append(FD_PROVIDE_PASSWD)
 
 	fencedev.addAttribute('hostname', hostname)
 	fencedev.addAttribute('login', log)
-	fencedev.addAttribute('passwd', pwd)
 	return errors
 
 def val_drac_fd(form, fencedev):
@@ -497,16 +677,36 @@
 	except Exception, e:
 		errors.append(FD_PROVIDE_LOGIN)
 
+	has_passwd = False
 	try:
 		pwd = form['passwd'].strip()
 		if not pwd:
 			raise Exception, 'blank'
+		fencedev.addAttribute('passwd', pwd)
+		has_passwd = True
 	except Exception, e:
+		try:
+			fencedev.removeAttribute('passwd')
+		except:
+			pass
+
+	try:
+		pwd_script = form['passwd_script'].strip()
+		if not pwd_script:
+			raise Exception, 'blank'
+		fencedev.addAttribute('passwd_script', pwd_script)
+		has_passwd = True
+	except Exception, e:
+		try:
+			fencedev.removeAttribute('passwd_script')
+		except:
+			pass
+
+	if not has_passwd:
 		errors.append(FD_PROVIDE_PASSWD)
 
 	fencedev.addAttribute('ipaddr', ip)
 	fencedev.addAttribute('login', log)
-	fencedev.addAttribute('passwd', pwd)
 	return errors
 
 def val_rps10_fd(form, fencedev):
@@ -547,11 +747,32 @@
 	except Exception, e:
 		errors.append(FD_PROVIDE_LOGIN)
 
+	has_passwd = False
 	try:
 		pwd = form['passwd'].strip()
 		if not pwd:
 			raise Exception, 'blank'
+		fencedev.addAttribute('passwd', pwd)
+		has_passwd = True
 	except Exception, e:
+		try:
+			fencedev.removeAttribute('passwd')
+		except:
+			pass
+
+	try:
+		pwd_script = form['passwd_script'].strip()
+		if not pwd_script:
+			raise Exception, 'blank'
+		fencedev.addAttribute('passwd_script', pwd_script)
+		has_passwd = True
+	except Exception, e:
+		try:
+			fencedev.removeAttribute('passwd_script')
+		except:
+			pass
+
+	if not has_passwd:
 		errors.append(FD_PROVIDE_PASSWD)
 
 	try:
@@ -578,7 +799,6 @@
 
 	fencedev.addAttribute('ipaddr', ip)
 	fencedev.addAttribute('login', log)
-	fencedev.addAttribute('passwd', pwd)
 	return errors
 
 def val_ilo_fd(form, fencedev):
@@ -598,14 +818,36 @@
 	except Exception, e:
 		errors.append(FD_PROVIDE_LOGIN)
 
+	has_passwd = False
 	try:
 		pwd = form['passwd'].strip()
+		if not pwd:
+			raise Exception, 'blank'
+		fencedev.addAttribute('passwd', pwd)
+		has_passwd = True
+	except Exception, e:
+		try:
+			fencedev.removeAttribute('passwd')
+		except:
+			pass
+
+	try:
+		pwd_script = form['passwd_script'].strip()
+		if not pwd_script:
+			raise Exception, 'blank'
+		fencedev.addAttribute('passwd_script', pwd_script)
+		has_passwd = True
 	except Exception, e:
+		try:
+			fencedev.removeAttribute('passwd_script')
+		except:
+			pass
+
+	if not has_passwd:
 		errors.append(FD_PROVIDE_PASSWD)
 
 	fencedev.addAttribute('hostname', hostname)
 	fencedev.addAttribute('login', log)
-	fencedev.addAttribute('passwd', pwd)
 	return errors
 
 FD_VALIDATE = {


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