From: rmccabe@sourceware.org <rmccabe@sourceware.org>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] conga/luci/site/luci/Extensions LuciValidation ...
Date: 5 Feb 2008 18:26:55 -0000 [thread overview]
Message-ID: <20080205182655.21882.qmail@sourceware.org> (raw)
CVSROOT: /cvs/cluster
Module name: conga
Changes by: rmccabe at sourceware.org 2008-02-05 18:26:55
Modified files:
luci/site/luci/Extensions: LuciValidation.py
luci/site/luci/Extensions/ClusterModel: ClusterNode.py
ModelBuilder.py
Log message:
Fix a bug that caused fence method blocks to be added inside the first child tag of cluster nodes (which need not be <fence>).
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/LuciValidation.py.diff?cvsroot=cluster&r1=1.6&r2=1.7
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/ClusterModel/ClusterNode.py.diff?cvsroot=cluster&r1=1.4&r2=1.5
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/ClusterModel/ModelBuilder.py.diff?cvsroot=cluster&r1=1.15&r2=1.16
--- conga/luci/site/luci/Extensions/LuciValidation.py 2008/01/23 04:34:09 1.6
+++ conga/luci/site/luci/Extensions/LuciValidation.py 2008/02/05 18:26:54 1.7
@@ -81,12 +81,12 @@
levels = node.getFenceLevels()
try:
- method_id = levels[fence_level - 1].getAttribute('name')
+ method_id = levels[min(1, fence_level - 1)].getAttribute('name')
if not method_id:
raise Exception, 'No method ID'
fence_method = Method()
fence_method.addAttribute('name', str(method_id))
- levels[fence_level - 1] = fence_method
+ levels[min(1, fence_level - 1)] = fence_method
except Exception, e:
method_id = fence_level
fence_method = Method()
@@ -102,7 +102,7 @@
break
if delete_target is not None:
try:
- node.getChildren()[0].removeChild(delete_target)
+ node.getFenceNode().removeChild(delete_target)
except Exception, e:
if LUCI_DEBUG_MODE is True:
luci_log.debug_verbose('vNFC9: %s: %r %s' \
@@ -251,23 +251,17 @@
continue
fence_method.addChild(retobj)
- if len(node.getChildren()) > 0:
- # There's already a <fence> block
- found_target = False
- for idx in xrange(len(levels)):
- if levels[idx].getAttribute('name') == method_id:
- found_target = True
- break
-
- if found_target is False:
- # There's a fence block, but no relevant method
- # block
- node.getChildren()[0].addChild(fence_method)
- else:
- # There is no <fence> tag under the node yet.
- fence_node = Fence()
+ fence_node = node.getFenceNode()
+ found_target = False
+ for idx in xrange(len(levels)):
+ if levels[idx].getAttribute('name') == method_id:
+ found_target = True
+ break
+
+ if found_target is False:
+ # There's a fence block, but no relevant method
+ # block
fence_node.addChild(fence_method)
- node.addChild(fence_node)
if len(errors) > 0:
return (False, {'errors': errors })
--- conga/luci/site/luci/Extensions/ClusterModel/ClusterNode.py 2008/01/02 20:56:08 1.4
+++ conga/luci/site/luci/Extensions/ClusterModel/ClusterNode.py 2008/02/05 18:26:55 1.5
@@ -6,6 +6,7 @@
# Free Software Foundation.
from TagObject import TagObject
+from Fence import Fence
TAG_NAME = "clusternode"
@@ -14,16 +15,21 @@
TagObject.__init__(self)
self.TAG_NAME = TAG_NAME
+ def getFenceNode(self):
+ ret = None
+ for child in self.getChildren():
+ if child.getTagName() == 'fence':
+ ret = child
+ break
+ if ret is None:
+ ret = Fence()
+ self.addChild(ret)
+ return ret
+
def getFenceLevels(self):
- #under this node will be a 'fence' block, then 0 or more 'method' blocks.
- #This method returns the set of 'method' objs. 'method' blocks represent
- #fence levels
- child = self.getChildren()
- if len(child) > 0:
- return child[0].getChildren()
- else:
- retval = list()
- return retval
+ # This method returns the set of 'method' objs. 'method' blocks represent
+ # fence levels
+ return self.getFenceNode().getChildren()
def getMulticastNode(self):
children = self.getChildren()
--- conga/luci/site/luci/Extensions/ClusterModel/ModelBuilder.py 2008/01/15 04:41:40 1.15
+++ conga/luci/site/luci/Extensions/ClusterModel/ModelBuilder.py 2008/02/05 18:26:55 1.16
@@ -981,13 +981,6 @@
mcast = self.mcast_ptr
mcast.addAttribute('addr', mcast_addr)
- if mcast_if is not None:
- mcast.addAttribute('interface', mcast_if)
- else:
- try:
- mcast.removeAttribute('interface')
- except:
- pass
self.mcast_address = mcast_addr
self.mcast_interface = mcast_if
self.usesMulticast = True
next reply other threads:[~2008-02-05 18:26 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-05 18:26 rmccabe [this message]
-- strict thread matches above, loose matches on Subject: below --
2008-01-17 16:36 [Cluster-devel] conga/luci/site/luci/Extensions LuciValidation 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=20080205182655.21882.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).