cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
From: rmccabe@sourceware.org <rmccabe@sourceware.org>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] conga/luci cluster/validate_config_qdisk.js si ...
Date: 23 Aug 2007 19:09:23 -0000	[thread overview]
Message-ID: <20070823190923.17948.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/cluster
Module name:	conga
Branch: 	RHEL5
Changes by:	rmccabe at sourceware.org	2007-08-23 19:09:21

Modified files:
	luci/cluster   : validate_config_qdisk.js 
	luci/site/luci/Extensions: cluster_adapters.py 

Log message:
	Fix a handful of qdisk config form bugs caught by Lon that prevent luci from creating many valid qdisk configurations

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/validate_config_qdisk.js.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.4.2.4&r2=1.4.2.5
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/cluster_adapters.py.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.120.2.37&r2=1.120.2.38

--- conga/luci/cluster/validate_config_qdisk.js	2007/08/08 21:18:46	1.4.2.4
+++ conga/luci/cluster/validate_config_qdisk.js	2007/08/23 19:09:21	1.4.2.5
@@ -180,17 +180,6 @@
 				clr_form_err(form.interval);
 		}
 
-		if (!form.votes || str_is_blank(form.votes.value)) {
-			errors.push('No votes setting was given.');
-			set_form_err(form.votes);
-		} else {
-			if (!is_valid_int(form.votes.value, 1, null)) {
-				errors.push('Votes values must be greater than 0.');
-				set_form_err(form.votes);
-			} else
-				clr_form_err(form.votes);
-		}
-
 		if (!form.tko || str_is_blank(form.tko.value)) {
 			errors.push('No TKO setting was given.');
 			set_form_err(form.tko);
@@ -202,15 +191,15 @@
 				clr_form_err(form.tko);
 		}
 
-		if (!form.min_score || str_is_blank(form.min_score.value)) {
-			errors.push('No minimum score setting was given.');
-			set_form_err(form.min_score);
+		if (!form.votes || str_is_blank(form.votes.value)) {
+			errors.push('No votes setting was given.');
+			set_form_err(form.votes);
 		} else {
-			if (!is_valid_int(form.min_score.value, 1, null)) {
-				errors.push('Minimum score values must be greater than 0.');
-				set_form_err(form.min_score);
+			if (!is_valid_int(form.votes.value, 1, null)) {
+				errors.push('Votes values must be greater than 0.');
+				set_form_err(form.votes);
 			} else
-				clr_form_err(form.min_score);
+				clr_form_err(form.votes);
 		}
 
 		var no_dev = !form.device || str_is_blank(form.device.value);
@@ -226,6 +215,23 @@
 				if (err)
 					errors = errors.concat(err);
 			}
+
+			if (hnum > 1) {
+				if (!form.min_score || str_is_blank(form.min_score.value)) {
+					errors.push('No minimum score setting was given.');
+					set_form_err(form.min_score);
+				} else {
+					if (!is_valid_int(form.min_score.value, 1, null)) {
+						errors.push('Minimum score values must be greater than 0.');
+						set_form_err(form.min_score);
+					} else
+						clr_form_err(form.min_score);
+				}
+			} else {
+				clr_form_err(form.min_score);
+			}
+		} else {
+			clr_form_err(form.min_score);
 		}
 	}
 
--- conga/luci/site/luci/Extensions/cluster_adapters.py	2007/08/09 04:34:52	1.120.2.37
+++ conga/luci/site/luci/Extensions/cluster_adapters.py	2007/08/23 19:09:21	1.120.2.38
@@ -1100,7 +1100,7 @@
 	for i in xrange(num_heuristics):
 		try:
 			h = form['heuristic%d' % i]
-			if not h or len(h) != 3:
+			if not h or len(h) != 3 or not (h[0].strip() and h[1].strip() and h[2].strip()):
 				continue
 		except:
 			continue
@@ -1110,26 +1110,26 @@
 			if not hprog:
 				raise Exception, 'no hprog'
 		except Exception, e:
-			errors.append('No program was given for heuristic %d' % i + 1)
+			errors.append('No program was given for heuristic %d' % (i + 1))
 		try:
 			hint = int(h[1])
 			if hint < 1:
 				raise ValueError, 'Heuristic interval values must be greater than 0'
 		except KeyError, e:
-			errors.append('No interval was given for heuristic %d' % i + 1)
+			errors.append('No interval was given for heuristic %d' % (i + 1))
 		except ValueError, e:
 			errors.append('An invalid interval was given for heuristic %d: %s' \
-				% (i + 1, str(e)))
+				% ((i + 1), str(e)))
 
 		try:
 			hscore = int(h[2])
 			if hscore < 1:
 				raise ValueError, 'Heuristic scores must be greater than 0'
 		except KeyError, e:
-			errors.append('No score was given for heuristic %d' % i + 1)
+			errors.append('No score was given for heuristic %d' % (i + 1))
 		except ValueError, e:
 			errors.append('An invalid score was given for heuristic %d: %s' \
-				% (i + 1, str(e)))
+				% ((i + 1), str(e)))
 
 		heuristics.append([ hprog, hint, hscore ])
 



             reply	other threads:[~2007-08-23 19:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-23 19:09 rmccabe [this message]
  -- strict thread matches above, loose matches on Subject: below --
2010-08-06 23:54 [Cluster-devel] conga/luci cluster/validate_config_qdisk.js si 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=20070823190923.17948.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).