# Add back the tags under the method block
# for the fence instance
- if type == 'fence_manual':
+ if fence_type == 'fence_manual':
instance_list.append({'name': fencedev_name, 'nodename': nodename })
else:
instance_list.append({'name': fencedev_name })
@@ -234,7 +234,7 @@
# so the appropriate XML goes into the <method> block inside
# <node><fence>. All we need for that is the device name.
if not fence_form.has_key('sharable'):
- if type == 'fence_manual':
+ if fence_type == 'fence_manual':
instance_list.append({'name': fencedev_name, 'nodename': nodename })
else:
instance_list.append({'name': fencedev_name })
--- conga/luci/site/luci/Extensions/FenceHandler.py 2008/01/02 21:00:31 1.29
+++ conga/luci/site/luci/Extensions/FenceHandler.py 2008/01/17 16:36:30 1.30
@@ -1055,6 +1055,12 @@
- 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)
+ 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()