Remove lxml deprecated methods
All our supported runtimes [1] are compatible with the recommended alternatives. The `getchildren` method is deprecated [2] since lxml 2.0 and will be removed in future versions, these changes switch usages to `list(elem)` as recommended in the official documentation [2]. [1] https://governance.openstack.org/tc/reference/runtimes/victoria.html#python-runtimes-for-train [2] https://lxml.de/api/lxml.etree._Element-class.html#getchildren Change-Id: Ibdc54cdc62d84ea98d4f21bb3698e6726e56365a
This commit is contained in:
parent
f1ebc15dfc
commit
385df41b70
|
@ -213,7 +213,7 @@ class LibvirtConfigDomainCapsDevices(LibvirtConfigObject):
|
||||||
def parse_dom(self, xmldoc):
|
def parse_dom(self, xmldoc):
|
||||||
super().parse_dom(xmldoc)
|
super().parse_dom(xmldoc)
|
||||||
|
|
||||||
for c in xmldoc.getchildren():
|
for c in list(xmldoc):
|
||||||
device = self.DEVICE_PARSERS.get(c.tag)
|
device = self.DEVICE_PARSERS.get(c.tag)
|
||||||
if device:
|
if device:
|
||||||
device = device()
|
device = device()
|
||||||
|
@ -281,7 +281,7 @@ class LibvirtConfigDomainCapsFeatureSev(LibvirtConfigObject):
|
||||||
if xmldoc.get('supported') == 'yes':
|
if xmldoc.get('supported') == 'yes':
|
||||||
self.supported = True
|
self.supported = True
|
||||||
|
|
||||||
for c in xmldoc.getchildren():
|
for c in list(xmldoc):
|
||||||
if c.tag == 'reducedPhysBits':
|
if c.tag == 'reducedPhysBits':
|
||||||
self.reduced_phys_bits = int(c.text)
|
self.reduced_phys_bits = int(c.text)
|
||||||
elif c.tag == 'cbitpos':
|
elif c.tag == 'cbitpos':
|
||||||
|
@ -3326,14 +3326,14 @@ class LibvirtConfigGuestVPMEM(LibvirtConfigGuestDevice):
|
||||||
self.model = xmldoc.get("model")
|
self.model = xmldoc.get("model")
|
||||||
self.access = xmldoc.get("access")
|
self.access = xmldoc.get("access")
|
||||||
|
|
||||||
for c in xmldoc.getchildren():
|
for c in list(xmldoc):
|
||||||
if c.tag == "source":
|
if c.tag == "source":
|
||||||
for sub in c.getchildren():
|
for sub in list(c):
|
||||||
if sub.tag == "path":
|
if sub.tag == "path":
|
||||||
self.source_path = sub.text
|
self.source_path = sub.text
|
||||||
if sub.tag == "alignsize":
|
if sub.tag == "alignsize":
|
||||||
self.align_size = sub.text
|
self.align_size = sub.text
|
||||||
elif c.tag == "target":
|
elif c.tag == "target":
|
||||||
for sub in c.getchildren():
|
for sub in list(c):
|
||||||
if sub.tag == "size":
|
if sub.tag == "size":
|
||||||
self.target_size = sub.text
|
self.target_size = sub.text
|
||||||
|
|
Loading…
Reference in New Issue