conga/luci/site/luci/Extensions cluster_adapte ...
CVSROOT: /cvs/cluster
Module name: conga
Changes by: jparsons at sourceware.org 2006-11-20 15:05:00
Modified files:
luci/site/luci/Extensions: cluster_adapters.py
Log message:
Fix for quorumd cluster props, part of bug #212021
luci/site/luci/Extensions/cluster_adapters.py +25 -9
@@ -588,19 +588,15 @@ except ValueError, e: errors.append('An invalid Minimum Score value was given: %s' % str(e)) + device = None + label = None #Either device or label must be present try: device = form['device'].strip() - if not device: - raise KeyError, 'device is none' - except KeyError, e: - errors.append('No Device value was given') - - try: label = form['label'].strip() - if not label: - raise KeyError, 'label is none' + if not device and not label: + raise KeyError, 'device and label are both none' except KeyError, e: - errors.append('No Label value was given') + errors.append('No Device or Label value was given') num_heuristics = 0 try:
@@ -655,6 +651,26 @@ 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) + if device: + qd.addAttribute('device', device) + else: + qd.addAttribute('label', label) + cp = model.getClusterPtr() + 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]) + qd.addChild(new_h) + return (True, {'messages': ['Changes accepted. - FILL ME IN']}) def validateGeneralConfig(model, form):