From mboxrd@z Thu Jan 1 00:00:00 1970 From: jparsons@sourceware.org Date: 20 Nov 2006 15:05:00 -0000 Subject: [Cluster-devel] conga/luci/site/luci/Extensions cluster_adapte ... Message-ID: <20061120150500.4320.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 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 Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/cluster_adapters.py.diff?cvsroot=cluster&r1=1.164&r2=1.165 --- conga/luci/site/luci/Extensions/cluster_adapters.py 2006/11/17 05:48:27 1.164 +++ conga/luci/site/luci/Extensions/cluster_adapters.py 2006/11/20 15:05:00 1.165 @@ -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):