From: kupcevic@sourceware.org <kupcevic@sourceware.org>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] conga/luci/site/luci/Extensions ModelBuilder.p ...
Date: 10 Jan 2007 21:48:26 -0000 [thread overview]
Message-ID: <20070110214826.23437.qmail@sourceware.org> (raw)
CVSROOT: /cvs/cluster
Module name: conga
Branch: RHEL5
Changes by: kupcevic at sourceware.org 2007-01-10 21:48:26
Modified files:
luci/site/luci/Extensions: ModelBuilder.py TagObject.py
Log message:
small piece of 212021 that enables ui when bad tags are passed in - prevents button lockup
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/ModelBuilder.py.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.8.2.4&r2=1.8.2.5
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/TagObject.py.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.1&r2=1.1.2.1
--- conga/luci/site/luci/Extensions/ModelBuilder.py 2007/01/10 19:26:56 1.8.2.4
+++ conga/luci/site/luci/Extensions/ModelBuilder.py 2007/01/10 21:48:26 1.8.2.5
@@ -122,6 +122,7 @@
self.isModified = False
self.quorumd_ptr = None
self.usesQuorumd = False
+ self.unusual_items = list()
self.isVirtualized = False
if mcast_addr == None:
self.usesMulticast = False
@@ -137,6 +138,7 @@
self.purgePCDuplicates()
self.resolve_references()
self.check_for_multicast()
+ self.check_for_nodeids()
else:
if filename == None:
if lock_type == DLM_TYPE:
@@ -160,7 +162,7 @@
self.check_for_multicast()
- def buildModel(self, parent_node):
+ def buildModel(self, parent_node, parent_object=None):
if parent_node == None:
parent_node = self.parent
@@ -178,8 +180,22 @@
attrNode = attrs.get(attrName)
attrValue = attrNode.nodeValue
new_object.addAttribute(attrName,attrValue)
- except KeyError, k:
+ except KeyError, k: ##This allows for custom tags
+ new_object = TagObject(parent_node.nodeName)
+ attrs = parent_node.attributes
+ for attrName in attrs.keys():
+ attrNode = attrs.get(attrName)
+ attrValue = attrNode.nodeValue
+ new_object.addAttribute(attrName, attrValue)
+ self.unusual_items.append((parent_object, new_object))
+ for item in parent_node.childNodes:
+ result_object = self.buildModel(item, new_object)
+ if result_object != None:
+ new_object.addChild(result_object)
return None
+
+ ######End of unusual item exception
+
if parent_node.nodeName == CLUSTER_PTR_STR:
self.cluster_ptr = new_object
if parent_node.nodeName == CLUSTERNODES_PTR_STR:
@@ -210,7 +226,7 @@
for item in parent_node.childNodes:
- result_object = self.buildModel(item)
+ result_object = self.buildModel(item,new_object)
if result_object != None:
new_object.addChild(result_object)
@@ -422,6 +438,7 @@
#check for dual power fences
self.dual_power_fence_check()
+ self.restore_unusual_items()
try:
@@ -431,15 +448,70 @@
self.isModified = False
+ ##Need to restore model
+ self.parent = doc
+
+ self.object_tree = self.buildModel(None)
+ self.check_empty_ptrs()
+ self.check_fence_daemon()
+ self.resolve_fence_instance_types()
+ self.purgePCDuplicates()
+ self.resolve_references()
+ self.check_for_multicast()
+
finally:
+ pass
#dual_power_fence_check() adds extra
#fence instance entries for dual power controllers
#These must be removed from the tree before the UI
#can be used
- self.purgePCDuplicates()
+ #self.purgePCDuplicates()
return strbuf
-
+
+ def restore_unusual_items(self):
+ for item in self.unusual_items:
+ duplicate = False
+ kids = item[0].getChildren()
+ for kid in kids:
+ if kid == item[1]:
+ duplicate = True
+ break
+ if duplicate == True:
+ continue
+ else:
+ item[0].addChild(item[1])
+
+ def check_for_nodeids(self):
+ nodes = self.getNodes()
+ for node in nodes:
+ if node.getAttribute('nodeid') == None:
+ new_id = self.getUniqueNodeID()
+ node.addAttribute('nodeid',new_id)
+
+ def getUniqueNodeID(self):
+ nodes = self.getNodes()
+ total_nodes = len(nodes)
+ dex_list = list()
+ for nd_idx in range (1, (total_nodes + 3)):
+ dex_list.append(str(nd_idx))
+
+ for dex in dex_list:
+ found = False
+ for node in nodes:
+ ndid = node.getAttribute('nodeid')
+ if ndid != None:
+ if ndid == dex:
+ found = True
+ break
+ else:
+ continue
+
+ if found == True:
+ continue
+ else:
+ return dex
+
def has_filepath(self):
if self.filename == None:
return False
--- conga/luci/site/luci/Extensions/TagObject.py 2006/05/30 20:17:21 1.1
+++ conga/luci/site/luci/Extensions/TagObject.py 2007/01/10 21:48:26 1.1.2.1
@@ -3,10 +3,13 @@
TAG_NAME = "document"
class TagObject:
- def __init__(self):
+ def __init__(self, tagname=None):
self.attr_hash = {}
self.children = list()
- self.TAG_NAME = TAG_NAME
+ if tagname == None:
+ self.TAG_NAME = TAG_NAME
+ else:
+ self.TAG_NAME = tagname
def addChild(self, child):
#print "in AddChild, adding child %s" % child.getName()
next reply other threads:[~2007-01-10 21:48 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-01-10 21:48 kupcevic [this message]
-- strict thread matches above, loose matches on Subject: below --
2007-05-11 2:38 [Cluster-devel] conga/luci/site/luci/Extensions ModelBuilder.p rmccabe
2007-05-11 2:38 rmccabe
2007-05-11 2:36 rmccabe
2007-02-15 18:55 rmccabe
2007-01-23 14:05 rmccabe
2007-01-23 14:01 rmccabe
2007-01-10 21:36 jparsons
2006-10-26 22:59 rmccabe
2006-10-24 15:05 jparsons
2006-10-24 1:42 jparsons
2006-10-06 21:08 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=20070110214826.23437.qmail@sourceware.org \
--to=kupcevic@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.