Fix AttributeError in ce_lacp on Python 3.9.

This commit is contained in:
Matt Clay 2020-03-01 13:32:02 -08:00
parent 44d8ce9b31
commit ac8f1ad4e2

View file

@ -313,7 +313,12 @@ def xml_to_dict(args):
root = ET.fromstring(args)
ifmtrunk = root.find('.//ifmtrunk')
if ifmtrunk is not None:
for ele in ifmtrunk.getiterator():
try:
ifmtrunk_iter = ET.Element.iter(ifmtrunk)
except AttributeError:
ifmtrunk_iter = ifmtrunk.getiterator()
for ele in ifmtrunk_iter:
if ele.text is not None and len(ele.text.strip()) > 0:
rdict[ele.tag] = ele.text
return rdict