summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCole Robinson <crobinso@redhat.com>2014-01-25 14:48:27 -0500
committerCole Robinson <crobinso@redhat.com>2014-01-25 17:20:30 -0500
commit16c8c31cbd66ff8ad24bef970773dcc261f8c114 (patch)
tree6d6c172ed1fc824267f1c7f41687b3d68161ab08
parent5edf4de058d425e3c660d09dd127b6458bc8df65 (diff)
downloadvirt-manager-16c8c31cbd66ff8ad24bef970773dcc261f8c114.tar.gz
xmlbuilder: Remove unneeded argument to _remove_xpath_node
-rw-r--r--virtinst/xmlbuilder.py12
1 files changed, 5 insertions, 7 deletions
diff --git a/virtinst/xmlbuilder.py b/virtinst/xmlbuilder.py
index 5e978cd6..e1a5fe11 100644
--- a/virtinst/xmlbuilder.py
+++ b/virtinst/xmlbuilder.py
@@ -195,7 +195,7 @@ def _build_xpath_node(ctx, xpath, addnode=None):
return parentnode
-def _remove_xpath_node(ctx, xpath, dofree=True, unlinkroot=True):
+def _remove_xpath_node(ctx, xpath, dofree=True):
"""
Remove an XML node tree if it has no content
"""
@@ -227,11 +227,9 @@ def _remove_xpath_node(ctx, xpath, dofree=True, unlinkroot=True):
white.unlinkNode()
white.freeNode()
- if not unlinkroot and node == root_node:
- # Don't unlink the root node. This is usually a programming error,
- # but the error usually cascades to a different spot and is hard
- # to pin down. With this we usually get invalid XML which is
- # easier to debug.
+ if node == root_node:
+ # Don't unlink the root node, since it's spread out to all
+ # child objects and it ends up wreaking havoc.
break
node.unlinkNode()
@@ -642,7 +640,7 @@ class XMLProperty(property):
for node, val, use_xpath in node_map:
if val is None or val is False:
- _remove_xpath_node(ctx, use_xpath, unlinkroot=False)
+ _remove_xpath_node(ctx, use_xpath)
continue
if not node: