summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Aubut <christopher@aubut.me>2022-07-13 15:53:08 +0000
committerIlya Maximets <i.maximets@ovn.org>2022-09-19 18:32:46 +0200
commitfcc8774005ceb60117cb238ad0852ac705e5cd9c (patch)
tree1b0216ba91c398e546993f6bbd613f2e5ec16dd0
parent60b1db0e22f7588bb5d09df81061db6ac9266d7a (diff)
downloadopenvswitch-fcc8774005ceb60117cb238ad0852ac705e5cd9c.tar.gz
python: idl: Fix idl.Row.__str__ method.
Fixes idl.Row's __str__ method to only print if the column exists on the object. The Row object passed to the 'updates' argument of Idl.notify only contains a subset of columns. Printing that argument causes an AttributeError. Fixes: 6a1c98461b46 ("Add a __str__ method to idl.Row") Submitted-at: https://github.com/openvswitch/ovs/pull/392 Acked-by: Terry Wilson <twilson@redhat.com> Signed-off-by: Christopher Aubut <christopher@aubut.me> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
-rw-r--r--python/ovs/db/idl.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/python/ovs/db/idl.py b/python/ovs/db/idl.py
index 7ecaeee6d..859e4bb2a 100644
--- a/python/ovs/db/idl.py
+++ b/python/ovs/db/idl.py
@@ -1031,7 +1031,8 @@ class Row(object):
return "{table}({data})".format(
table=self._table.name,
data=", ".join("{col}={val}".format(col=c, val=getattr(self, c))
- for c in sorted(self._table.columns)))
+ for c in sorted(self._table.columns)
+ if hasattr(self, c)))
def __getattr__(self, column_name):
assert self._changes is not None