mirror of
https://github.com/openvswitch/ovs
synced 2025-09-04 00:05:15 +00:00
python: idl: Raise AttributeError from uuid_to_row.
Prior to4e3966e64
, when calling _uuid_to_row, it would raise an AttributeError when trying to access base.ref_table.rows if the referenced table was not registered. When called from Row.__getattr__(), this would appropriately raise an AttributeError. After4e3966e64
, a KeyError would be raised, which is not expected from a getattr() or hasattr() call, which could break existing code. Fixes:4e3966e64b
("python: Politely handle misuse of table.condition.") Signed-off-by: Terry Wilson <twilson@redhat.com> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
This commit is contained in:
committed by
Ilya Maximets
parent
218dad97da
commit
7d35554425
@@ -1299,7 +1299,12 @@ class Row(object):
|
|||||||
|
|
||||||
def _uuid_to_row(self, atom, base):
|
def _uuid_to_row(self, atom, base):
|
||||||
if base.ref_table:
|
if base.ref_table:
|
||||||
return self._idl.tables[base.ref_table.name].rows.get(atom)
|
try:
|
||||||
|
table = self._idl.tables[base.ref_table.name]
|
||||||
|
except KeyError as e:
|
||||||
|
msg = "Table {} is not registered".format(base.ref_table.name)
|
||||||
|
raise AttributeError(msg) from e
|
||||||
|
return table.rows.get(atom)
|
||||||
else:
|
else:
|
||||||
return atom
|
return atom
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user