# node already exists
continue
- node_tag = etree.SubElement(self.xml, 'node', exclusive='false')
+ node_tag = etree.SubElement(self.xml.root, 'node', exclusive='false')
if 'network_urn' in node:
node_tag.set('component_manager_id', node['network_urn'])
if 'urn' in node:
def merge_node(self, source_node_tag):
# this is untested
- self.xml.append(deepcopy(source_node_tag))
+ self.xml.root.append(deepcopy(source_node_tag))
def add_slivers(self, slivers, sliver_urn=None, no_dupes=False):
tree = etree.parse(StringIO(in_rspec))
root = tree.getroot()
for child in root.getchildren():
- self.xml.append(child)
+ self.xml.root.append(child)
def cleanup(self):
# remove unncecessary elements, attributes
def add_network(self, network):
network_tags = self.xml.xpath('//network[@name="%s"]' % network)
if not network_tags:
- network_tag = etree.SubElement(self.xml, 'network', name=network)
+ network_tag = etree.SubElement(self.xml.root, 'network', name=network)
else:
network_tag = network_tags[0]
return network_tag
# node already exists
continue
- network_tag = self.xml
+ network_tag = self.xml.root
if 'network' in node:
network = node['network']
network_tag = self.add_network(network)
for network in networks:
current_network = network.get('name')
if current_network and current_network not in current_networks:
- self.xml.append(network)
+ self.xml.root.append(network)
current_networks.append(current_network)
if __name__ == '__main__':