References: fate#319621 Subject: xmlbuilder: Opencode single addnode= usage From: Cole Robinson crobinso@redhat.com Mon Jul 18 13:34:06 2016 -0400 Date: Mon Jul 18 14:46:50 2016 -0400: Git: a931a1a6adf768f73c223f9b8d78fb7ca25cb0a3 Index: virt-manager-1.4.0/virtinst/xmlbuilder.py =================================================================== --- virt-manager-1.4.0.orig/virtinst/xmlbuilder.py +++ virt-manager-1.4.0/virtinst/xmlbuilder.py @@ -156,7 +156,7 @@ def _add_pretty_child(parentnode, newnod return newnode -def _build_xpath_node(ctx, xpath, addnode=None): +def _build_xpath_node(ctx, xpath): """ Build all nodes required to set an xpath. If we have XML , and want to set xpath /foo/bar/baz@booyeah, we create node 'bar' and 'baz' @@ -197,9 +197,6 @@ def _build_xpath_node(ctx, xpath, addnod newnode = libxml2.newNode(nodename) parentnode = _add_pretty_child(parentnode, newnode) - if addnode: - parentnode = _add_pretty_child(parentnode, addnode) - return parentnode @@ -989,7 +986,9 @@ class XMLBuilder(object): use_xpath = obj.get_root_xpath().rsplit("/", 1)[0] indent = 2 * obj.get_root_xpath().count("/") newnode = libxml2.parseDoc(util.xml_indent(xml, indent)).children - _build_xpath_node(self._xmlstate.xml_ctx, use_xpath, newnode) + parentnode = _build_xpath_node(self._xmlstate.xml_ctx, use_xpath) + # Tack newnode on the end + _add_pretty_child(parentnode, newnode) obj._parse_with_children(None, self._xmlstate.xml_node) def remove_child(self, obj):