fix lxml warning

This commit is contained in:
brent s. 2020-08-02 03:51:51 -04:00
parent 539c4bf465
commit 6006554ad1
Signed by: bts
GPG Key ID: 8C004C2F93481F6B

View File

@ -37,7 +37,7 @@ class DomainNetwork(object):
for iface in self.dom_xml.xpath('devices/interface'): for iface in self.dom_xml.xpath('devices/interface'):
if iface.attrib.get('type') == 'network': if iface.attrib.get('type') == 'network':
src_xml = iface.find('source') src_xml = iface.find('source')
if src_xml and src_xml.attrib.get('network') in netnames: if src_xml is not None and src_xml.attrib.get('network') in netnames:
# Why, oh why, does the libvirt API want the XML?? # Why, oh why, does the libvirt API want the XML??
self.ifaces.append(etree.tostring(iface).decode('utf-8')) self.ifaces.append(etree.tostring(iface).decode('utf-8'))
return(None) return(None)