CVSROOT:        /cvs/cluster
Module name:    conga
Branch:         RHEL5
Changes by:     [EMAIL PROTECTED]       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 via email to