From mboxrd@z Thu Jan 1 00:00:00 1970 From: rmccabe@sourceware.org Date: 16 Feb 2007 05:29:39 -0000 Subject: [Cluster-devel] conga/luci cluster/form-macros cluster/validat ... Message-ID: <20070216052939.23837.qmail@sourceware.org> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit CVSROOT: /cvs/cluster Module name: conga Branch: RHEL4 Changes by: rmccabe at sourceware.org 2007-02-16 05:29:38 Modified files: luci/cluster : form-macros validate_config_qdisk.js luci/site/luci/Extensions: cluster_adapters.py Log message: - Only set the totem params cman actually reads - Fix a bunch of bugs relating to qdisk properties Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/form-macros.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.176.2.11&r2=1.176.2.12 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/validate_config_qdisk.js.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.5&r2=1.5.2.1 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/cluster_adapters.py.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.227.2.8&r2=1.227.2.9 --- conga/luci/cluster/form-macros 2007/02/16 02:12:46 1.176.2.11 +++ conga/luci/cluster/form-macros 2007/02/16 05:29:38 1.176.2.12 @@ -640,12 +640,56 @@ + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - +
+ Token Timeout (ms) + + +
+ Number of token retransmits before loss + + +
+ Join Timeout (ms) + + +
+ Consensus Timeout (ms) + + +
Secure Authentication
Redundant Ring Protocol Mode @@ -703,16 +747,6 @@
- Token Timeout (ms) - - -
Token Retransmit (ms) @@ -734,27 +768,6 @@
- Number of retransmits before loss - - -
- Join Timeout (ms) - - -
Maximum time to wait before sending a join message (ms) @@ -765,17 +778,6 @@
- Consensus Timeout (ms) - - -
Merge Detection Timeout (ms) @@ -894,6 +896,7 @@ tal:attributes="value string:47" />
@@ -1092,14 +1095,14 @@ + tal:attributes="checked python: (not clusterinfo['is_quorumd']) and 'checked' or ''" /> Do not use a Quorum Partition + tal:attributes="checked python: (clusterinfo['is_quorumd']) and 'checked' or ''" /> Use a Quorum Partition @@ -1114,48 +1117,48 @@ Interval - + Votes - + TKO - + Minimum Score - + Device - + Label - + @@ -1172,9 +1175,6 @@ -
Name
- -
Path to Program
@@ -1190,22 +1190,22 @@ + tal:define="global heuristics clusterinfo/hlist | nothing"> - + - - - - + - + - + - - - + name python: 'heuristic' + str(curHeur) + ':hprog'" /> + + name python: 'heuristic' + str(curHeur) + ':hinterval'" /> + + name python: 'heuristic' + str(curHeur) + ':hscore'" /> + name python: 'heuristic' + str(curHeur) + ':hdel'" /> + - + @@ -1281,10 +1277,9 @@
+ onClick="validate_form(this.form)" />
- --- conga/luci/cluster/validate_config_qdisk.js 2006/12/21 05:08:48 1.5 +++ conga/luci/cluster/validate_config_qdisk.js 2007/02/16 05:29:38 1.5.2.1 @@ -1,4 +1,4 @@ -var heuristic_names = [ ':hname', ':hprog', ':hinterval', ':hscore', ':hdel' ]; +var heuristic_names = [ ':hprog', ':hinterval', ':hscore', ':hdel' ]; function clear_heuristic(form, heur_num) { var str_prefix = 'heuristic' + heur_num; @@ -82,26 +82,14 @@ var hstr = 'heuristic' + hnum; - var hname = document.getElementById(hstr + ':hname'); - if (!hname || str_is_blank(hname.value)) { - ++blank; - errors.push('No name was given for heuristic ' + (hnum + 1)); - set_form_err(hname); - } else { - /* XXX sanity check the name */ - hname = hname.value; - clr_form_err(hname); - } - - var hpath = document.getElementById(hstr + ':hpath'); - if (!hpath || str_is_blank(hpath.value)) { + var hprog = document.getElementById(hstr + ':hprog'); + if (!hprog || str_is_blank(hprog.value)) { ++blank; errors.push('No path was given for heuristic ' + (hnum + 1)); - set_form_err(hpath); + set_form_err(hprog); } else { /* XXX sanity check the path */ - hpath = hpath.value; - clr_form_err(hpath); + clr_form_err(hprog); } var hint = document.getElementById(hstr + ':hinterval'); @@ -110,8 +98,7 @@ errors.push('No interval was given for heuristic ' + (hnum + 1)); set_form_err(hint); } else { - hint = hint.value; - if (!is_valid_int(hint, 1, null)) { + if (!is_valid_int(hint.value, 1, null)) { errors.push('Heuristic interval values must be greater than 0.'); set_form_err(hint); } else @@ -124,18 +111,16 @@ errors.push('No score was given for heuristic ' + (hnum + 1)); set_form_err(hscore); } else { - hscore = hscore.value; - if (!is_valid_int(hscore, 0, null)) { + if (!is_valid_int(hscore.value, 0, null)) { errors.push('Heuristic score values must be 0 or greater.'); set_form_err(hscore); } else clr_form_err(hscore); } - if (blank == 4) { + if (blank == 3) { /* The entry is blank -- ignore it. */ - clr_form_err(hname); - clr_form_err(hpath); + clr_form_err(hprog); clr_form_err(hint); clr_form_err(hscore); return (null); @@ -219,30 +204,15 @@ clr_form_err(form.min_score); } - if (!form.device || str_is_blank(form.device.value)) { - errors.push('No device setting was given.'); - set_form_err(form.device); - } else { - /* TODO: check this */ - var device = form.device.value; - clr_form_err(form.device); - } - - if (!form.label || str_is_blank(form.label.value)) { - errors.push('No label setting was given.'); - set_form_err(form.label); - } else { - /* TODO: check this */ - var label = form.device.label; - clr_form_err(form.label); - } + var no_dev = !form.device || str_is_blank(form.device.value); + var no_label = !form.label || str_is_blank(form.label.value); + if (no_dev && no_label) + errors.push('You must give either a label or a device.'); var hnum = document.getElementById('num_heuristics'); if (hnum) { - hnum = Number(hnum.value); - if (hnum === 0) - hnum++; - for (var i = 0 ; i < hnum ; i++) { + hnum = Number(hnum.value) + 1; + for (var i = 0 ; i <= hnum ; i++) { var err = check_heuristic(i, form); if (err) errors = errors.concat(err); @@ -252,6 +222,7 @@ if (error_dialog(errors)) return (-1); + if (confirm('Update quorum partition properties?')) form.submit(); } @@ -275,15 +246,6 @@ var hstr = 'heuristic' + cur_hnum; - var name_td = document.createElement('td'); - name_td.className = 'systemsTable'; - var name_input = document.createElement('input'); - name_input.className = 'qdname qdisk'; - name_input.setAttribute('name', hstr + ':hname'); - name_input.setAttribute('id', hstr + ':hname'); - name_input.setAttribute('type', 'text'); - name_td.appendChild(name_input); - var path_td = document.createElement('td'); path_td.className = 'systemsTable'; var path_input = document.createElement('input'); @@ -325,7 +287,6 @@ var tr = document.createElement('tr'); tr.className = 'systemsTable'; tr.setAttribute('id', 'heuristic' + cur_hnum); - tr.appendChild(name_td); tr.appendChild(path_td); tr.appendChild(interval_td); tr.appendChild(score_td); --- conga/luci/site/luci/Extensions/cluster_adapters.py 2007/02/16 02:12:46 1.227.2.8 +++ conga/luci/site/luci/Extensions/cluster_adapters.py 2007/02/16 05:29:38 1.227.2.9 @@ -1013,8 +1013,16 @@ except KeyError, e: return (False, {'errors': ['An invalid quorum partition selection was made']}) + cp = model.getClusterPtr() + qdp = model.getQuorumdPtr() + if not qdisk_val: - return (True, {'messages': ['Changes accepted. - FILL ME IN']}) + if qdp: + try: + cp.removeChild(qdp) + except Exception, e: + return (False, {'errors': [ 'Error disabling quorum partition: %s' % str(e) ] }) + return (True, {}) try: interval = int(form['interval']) @@ -1054,22 +1062,25 @@ #Either device or label must be present device = None - label = None try: device = form['device'].strip() + except: + device = None + + label = None + try: label = form['label'].strip() - if not device and not label: - raise KeyError, 'device and label are both none' - except KeyError, e: + except: + label = None + + if not device and not label: errors.append('No Device or Label value was given') num_heuristics = 0 try: - num_heuristics = int(form['num_heuristics']) - if num_heuristics < 0: - raise ValueError, 'invalid number of heuristics: %s' % form['num_heuristics'] - if num_heuristics == 0: - num_heuristics = 1 + num_heuristics = int(form['num_heuristics']) + 1 + if num_heuristics < 1: + raise ValueError, form['num_heuristics'] except KeyError, e: errors.append('No number of heuristics was given.') except ValueError, e: @@ -1077,65 +1088,67 @@ heuristics = list() for i in xrange(num_heuristics): - prefix = 'heuristic' + str(i) + ':' try: - hname = form[prefix + 'hname'].strip() - if not hname: - raise KeyError(prefix + 'hname') - except KeyError, e: - if ((not prefix + 'hpath' in form or not form['hpath'].strip()) and - (not prefix + 'hint' in form or not form['hint'].strip()) and - (not prefix + 'hscore' in form or not form['hscore'].strip())): - # The row is blank; ignore it. + h = form['heuristic%d' % i] + if not h or len(h) != 3: continue - errors.append('No heuristic name was given for heuristic #%d' % i + 1) + except: + continue try: - hpath = form[prefix + 'hpath'] - except KeyError, e: - errors.append('No heuristic path was given for heuristic #%d' % i + 1) - + hprog = h[0] + if not hprog: + raise Exception, 'no hprog' + except Exception, e: + errors.append('No program was given for heuristic %d' % i + 1) try: - hint = int(form[prefix + 'hint']) + hint = int(h[1]) if hint < 1: raise ValueError, 'Heuristic interval values must be greater than 0' except KeyError, e: - errors.append('No heuristic 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 heuristic interval was given for heuristic #%d: %s' % (i + 1, str(e))) + errors.append('An invalid interval was given for heuristic %d: %s' \ + % (i + 1, str(e))) try: - hscore = int(form[prefix + 'score']) + hscore = int(h[2]) if hscore < 1: raise ValueError, 'Heuristic scores must be greater than 0' except KeyError, e: - errors.append('No heuristic 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 heuristic score was given for heuristic #%d: %s' % (i + 1, str(e))) - heuristics.append([ hname, hpath, hint, hscore ]) + errors.append('An invalid score was given for heuristic %d: %s' \ + % (i + 1, str(e))) + + heuristics.append([ hprog, hint, hscore ]) if len(errors) > 0: return (False, {'errors': errors }) qd = QuorumD() - qd.addAttribute('interval', interval) - qd.addAttribute('votes', votes) - qd.addAttribute('tko', tko) - qd.addAttribute('min_score', min_score) + qd.addAttribute('interval', str(interval)) + qd.addAttribute('votes', str(votes)) + qd.addAttribute('tko', str(tko)) + qd.addAttribute('min_score', str(min_score)) if device: - qd.addAttribute('device', device) + qd.addAttribute('device', str(device)) else: - qd.addAttribute('label', label) + qd.addAttribute('label', str(label)) - cp = model.getClusterPtr() + if qdp: + try: + cp.removeChild(qdp) + except: + pass cp.addChild(qd) for h in heuristics: new_h = Heuristic() - new_h.addAttribute('program', h[1]) - new_h.addAttribute('interval', h[2]) - new_h.addAttribute('score', h[3]) + new_h.addAttribute('program', str(h[0])) + new_h.addAttribute('interval', str(h[1])) + new_h.addAttribute('score', str(h[2])) qd.addChild(new_h) if len(errors) > 0: @@ -1169,8 +1182,9 @@ version_num = int(form['cfgver']) if version_num < old_ver: raise ValueError, 'configuration version number must be %d or greater.' % old_ver - # we'll increment the cluster version before propagating it. - version_num -= 1 + if version_num != old_ver: + # we'll increment the cluster version before propagating it. + version_num -= 1 except KeyError, e: errors.append('No cluster configuration version was given.') except ValueError, e: @@ -1194,79 +1208,11 @@ return (False, {'errors': errors}) return (True, {}) -# totem = model.getTotemPtr() -# if totem is None: -# cp = model.getClusterPtr() -# totem = Totem() -# cp.addChild(totem) - totem = Totem() - - if form.has_key('secauth'): - totem.addAttribute('secauth', '1') - else: - totem.addAttribute('secauth', '0') - - try: - rrp_mode = form['rrp_mode'].strip().lower() - if not rrp_mode: - raise KeyError, 'rrp_mode' - if rrp_mode != 'none' and rrp_mode != 'active' and 'rrp_mode' != 'passive': - raise Exception, '%s is an invalid value for redundant ring protocol mode' % rrp_mode - totem.addAttribute('rrp_mode', str(rrp_mode)) - except KeyError, e: - try: - totem.removeAttribute('rrp_mode') - except: - pass - except Exception, e: - errors.append(str(e)) - - try: - net_mtu = form['net_mtu'].strip() - if not net_mtu: - raise KeyError, 'net_mtu' - net_mtu = int(net_mtu) - if net_mtu < 1: - raise ValueError, '%d is an invalid value for network MTU' % net_mtu - totem.addAttribute('net_mtu', str(net_mtu)) - except KeyError, e: - try: - totem.removeAttribute('net_mtu') - except: - pass - except Exception, e: - errors.append(str(e)) - - try: - threads = form['threads'].strip() - if not threads: - raise KeyError, 'threads' - threads = int(threads) - if threads < 0: - raise ValueError, '%d is an invalid value for number of threads' % threads - totem.addAttribute('threads', str(threads)) - except KeyError, e: - try: - totem.removeAttribute('threads') - except: - pass - except Exception, e: - errors.append(str(e)) - - try: - vsftype = form['vsftype'].strip().lower() - if not vsftype: - raise KeyError, 'vsftype' - if vsftype != 'none' and vsftype != 'ykd': - raise ValueError, '%s is an invalid value for virtual synchrony type' % vsftype - totem.addAttribute('vsftype', str(vsftype)) - except KeyError, e: - try: - totem.removeAttribute('vsftype') - except: - pass - except Exception, e: - errors.append(str(e)) + totem = model.getTotemPtr() + if totem is None: + cp = model.getClusterPtr() + totem = Totem() + cp.addChild(totem) try: token = form['token'].strip() @@ -1285,48 +1231,16 @@ errors.append(str(e)) try: - token_retransmit = form['token_retransmit'].strip() - if not token_retransmit: - raise KeyError, 'token_retransmit' - token_retransmit = int(token_retransmit) - if token_retransmit < 1: - raise ValueError, '%d is an invalid value for token retransmit' % token_retransmit - totem.addAttribute('token_retransmit', str(token_retransmit)) + token_retransmits_before_loss_const = form['token_retransmits_before_loss_const'].strip() + if not token_retransmits_before_loss_const: + raise KeyError, 'token_retransmits_before_loss_const' + token_retransmits_before_loss_const = int(token_retransmits_before_loss_const) + if token_retransmits_before_loss_const < 1: + raise ValueError, '%d is an invalid value for number of token retransmits before loss' % token_retransmits_before_loss_const + totem.addAttribute('token_retransmits_before_loss_const', str(token_retransmits_before_loss_const)) except KeyError, e: try: - totem.removeAttribute('token_retransmit') - except: - pass - except Exception, e: - errors.append(str(e)) - - try: - hold = form['hold'].strip() - if not hold: - raise KeyError, 'hold' - hold = int(hold) - if hold < 1: - raise ValueError, '%d is not a valid value for hold token timeout' % hold - totem.addAttribute('hold', str(hold)) - except KeyError, e: - try: - totem.removeAttribute('hold') - except: - pass - except Exception, e: - errors.append(str(e)) - - try: - retransmits_before_loss = form['retransmits_before_loss'].strip() - if not retransmits_before_loss: - raise KeyError, 'retransmits_before_loss' - retransmits_before_loss = int(retransmits_before_loss) - if retransmits_before_loss < 1: - raise ValueError, '%d is an invalid value for number of retransmits before loss' % retransmits_before_loss - totem.addAttribute('retransmits_before_loss', str(retransmits_before_loss)) - except KeyError, e: - try: - totem.removeAttribute('retransmits_before_loss') + totem.removeAttribute('token_retransmits_before_loss_const') except: pass except Exception, e: @@ -1349,22 +1263,6 @@ errors.append(str(e)) try: - send_join = form['send_join'].strip() - if not send_join: - raise KeyError, 'send_join' - send_join = int(send_join) - if send_join < 0: - raise ValueError, '%d is an invalid value for time to wait before sending a join message' % send_join - totem.addAttribute('send_join', str(send_join)) - except KeyError, e: - try: - totem.removeAttribute('send_join') - except: - pass - except Exception, e: - errors.append(str(e)) - - try: consensus = form['consensus'].strip() if not consensus: raise KeyError, 'consensus' @@ -1380,182 +1278,6 @@ except Exception, e: errors.append(str(e)) - try: - merge = form['merge'].strip() - if not merge: - raise KeyError, 'merge' - merge = int(merge) - if merge < 1: - raise ValueError, '%d is an invalid value for merge detection timeout' % merge - totem.addAttribute('merge', str(merge)) - except KeyError, e: - try: - totem.removeAttribute('merge') - except: - pass - except Exception, e: - errors.append(str(e)) - - try: - downcheck = form['downcheck'].strip() - if not downcheck: - raise KeyError, 'downcheck' - downcheck = int(downcheck) - if downcheck < 1: - raise ValueError, '%d is an invalid value for interface down check timeout' % downcheck - totem.addAttribute('downcheck', str(downcheck)) - except KeyError, e: - try: - totem.removeAttribute('downcheck') - except: - pass - except Exception, e: - errors.append(str(e)) - - try: - fail_to_recv_const = form['fail_to_recv_const'].strip() - if not fail_to_recv_const: - raise KeyError, 'fail_to_recv_const' - fail_to_recv_const = int(fail_to_recv_const) - if fail_to_recv_const < 1: - raise ValueError, '%d is an invalid value for fail to receive constant' % fail_to_recv_const - totem.addAttribute('fail_to_recv_const', str(fail_to_recv_const)) - except KeyError, e: - try: - totem.removeAttribute('fail_to_recv_const') - except: - pass - except Exception, e: - errors.append(str(e)) - - try: - seqno_unchanged_const = form['seqno_unchanged_const'].strip() - if not seqno_unchanged_const: - raise KeyError, 'seqno_unchanged_const' - seqno_unchanged_const = int(seqno_unchanged_const) - if seqno_unchanged_const < 1: - raise ValueError, '%d is an invalid value for rotations with no multicast traffic before merge detection timeout started' % seqno_unchanged_const - totem.addAttribute('seqno_unchanged_const', str(seqno_unchanged_const)) - except KeyError, e: - try: - totem.removeAttribute('seqno_unchanged_const') - except: - pass - except Exception, e: - errors.append(str(e)) - - try: - heartbeat_failures_allowed = form['heartbeat_failures_allowed'].strip() - if not heartbeat_failures_allowed: - raise KeyError, 'heartbeat_failures_allowed' - heartbeat_failures_allowed = int(heartbeat_failures_allowed) - if heartbeat_failures_allowed < 0: - raise ValueError, '%d is an invalid value for number of heartbeat failures allowed' % heartbeat_failures_allowed - totem.addAttribute('heartbeat_failures_allowed', str(heartbeat_failures_allowed)) - except KeyError, e: - try: - totem.removeAttribute('heartbeat_failures_allowed') - except: - pass - except Exception, e: - errors.append(str(e)) - - try: - max_network_delay = form['max_network_delay'].strip() - if not max_network_delay: - raise KeyError, 'max_network_delay' - max_network_delay = int(max_network_delay) - if max_network_delay < 1: - raise ValueError, '%d is an invalid value for maximum network delay' % max_network_delay - totem.addAttribute('max_network_delay', str(max_network_delay)) - except KeyError, e: - try: - totem.removeAttribute('max_network_delay') - except: - pass - except Exception, e: - errors.append(str(e)) - - try: - window_size = form['window_size'].strip() - if not window_size: - raise KeyError, 'window_size' - window_size = int(window_size) - if window_size < 1: - raise ValueError, '%d is an invalid value for window size' % window_size - totem.addAttribute('window_size', str(window_size)) - except KeyError, e: - try: - totem.removeAttribute('window_size') - except: - pass - except Exception, e: - errors.append(str(e)) - - try: - max_messages = form['max_messages'].strip() - if not max_messages: - raise KeyError, 'max_messages' - max_messages = int(max_messages) - if max_messages < 1: - raise ValueError, '%d is an invalid value for maximum messages' % max_messages - totem.addAttribute('max_messages', str(max_messages)) - except KeyError, e: - try: - totem.removeAttribute('max_messages') - except: - pass - except Exception, e: - errors.append(str(e)) - - try: - rrp_problem_count_timeout = form['rrp_problem_count_timeout'].strip() - if not rrp_problem_count_timeout: - raise KeyError, 'rrp_problem_count_timeout' - rrp_problem_count_timeout = int(rrp_problem_count_timeout) - if rrp_problem_count_timeout < 1: - raise ValueError, '%d is an invalid value for RRP problem count timeout' % rrp_problem_count_timeout - totem.addAttribute('rrp_problem_count_timeout', str(rrp_problem_count_timeout)) - except KeyError, e: - try: - totem.removeAttribute('rrp_problem_count_timeout') - except: - pass - except Exception, e: - errors.append(str(e)) - - try: - rrp_problem_count_threshold = form['rrp_problem_count_threshold'].strip() - if not rrp_problem_count_threshold: - raise KeyError, 'rrp_problem_count_threshold' - rrp_problem_count_threshold = int(rrp_problem_count_threshold) - if rrp_problem_count_threshold < 1: - raise ValueError, '%d is an invalid value for RRP problem count threshold' % rrp_problem_count_threshold - totem.addAttribute('rrp_problem_count_threshold', str(rrp_problem_count_threshold)) - except KeyError, e: - try: - totem.removeAttribute('rrp_problem_count_threshold') - except: - pass - except Exception, e: - errors.append(str(e)) - - try: - rrp_token_expired_timeout = form['rrp_token_expired_timeout'].strip() - if not rrp_token_expired_timeout: - raise KeyError, 'rrp_token_expired_timeout' - rrp_token_expired_timeout = int(rrp_token_expired_timeout) - if rrp_token_expired_timeout < 1: - raise ValueError, '%d is an invalid value for RRP token expired timeout' % rrp_token_expired_timeout - totem.addAttribute('rrp_token_expired_timeout', str(rrp_token_expired_timeout)) - except KeyError, e: - try: - totem.removeAttribute('rrp_token_expired_timeout') - except: - pass - except Exception, e: - errors.append(str(e)) - if len(errors) > 0: return (False, {'errors': errors}) return (True, {}) @@ -4173,6 +3895,7 @@ luci_log.debug_verbose('GCI0: unable to determine cluster name') return {} + clumap = {} if model is None: try: model = getModelForCluster(self, cluname) @@ -4182,9 +3905,12 @@ except Exception, e: luci_log.debug_verbose('GCI1: unable to get model for cluster %s: %s' % (cluname, str(e))) return {} + else: + totem = model.getTotemPtr() + if totem: + clumap['totem'] = totem.getAttributes() prop_baseurl = req['URL'] + '?' + PAGETYPE + '=' + CLUSTER_CONFIG + '&' + CLUNAME + '=' + cluname + '&' - clumap = {} basecluster_url = prop_baseurl + PROPERTIES_TAB + "=" + PROP_GENERAL_TAB #needed: clumap['basecluster_url'] = basecluster_url @@ -4286,27 +4012,21 @@ clumap['label'] = label heuristic_kids = qdp.getChildren() - h_ctr = 0 + for kid in heuristic_kids: hmap = {} - hname = kid.getAttribute('name') - if hname is None: - hname = h_ctr - h_ctr = h_ctr + 1 hprog = kid.getAttribute('program') - hscore = kid.getAttribute('score') - hinterval = kid.getAttribute('interval') if hprog is None: continue - if hname is not None: - hmap['hname'] = hname - else: - hmap['hname'] = "" + + hscore = kid.getAttribute('score') hmap['hprog'] = hprog if hscore is not None: hmap['hscore'] = hscore else: hmap['hscore'] = "" + + hinterval = kid.getAttribute('interval') if hinterval is not None: hmap['hinterval'] = hinterval else: