Browse Source

Accept a Row as a result in AddCommand

Make AddCommand a little more lenient and accept Row/RowView objs
as results.

Conflicts:
      ovsdbapp/backend/ovs_idl/command.py

Change-Id: I17c24fd88adecbea09c71741c0105df1d0240e66
Related-Bug: 1871104
(cherry picked from commit 0338c0bb5cd6368edc14bff8e64f980d4a6286ac)
(cherry picked from commit fd0629f140fe34d24b567ec6d6a10a833f826ce9)
tags/0.15.1^0
Terry Wilson 3 months ago
parent
commit
1e538a2d71
1 changed files with 12 additions and 2 deletions
  1. +12
    -2
      ovsdbapp/backend/ovs_idl/command.py

+ 12
- 2
ovsdbapp/backend/ovs_idl/command.py View File

@@ -15,6 +15,7 @@
import collections
import logging

import ovs.db.idl
import six

from ovsdbapp import api
@@ -75,8 +76,17 @@ class AddCommand(BaseCommand):
def post_commit(self, txn):
# If get_insert_uuid fails, self.result was not a result of a
# recent insert. Most likely we are post_commit after a lookup()
real_uuid = txn.get_insert_uuid(self.result) or self.result
row = self.api.tables[self.table_name].rows[real_uuid]
if isinstance(self.result, rowview.RowView):
return
if isinstance(self.result, ovs.db.idl.Row):
row = self.result
else:
real_uuid = txn.get_insert_uuid(self.result) or self.result
# If we have multiple commands in a transation, post_commit can
# be called even if *this* command caused no change. Theoretically
# the subclass should have set a UUID/RowView result in that case
# which is handled above, so raise exception if real_uuid not found
row = self.api.tables[self.table_name].rows[real_uuid]
self.result = rowview.RowView(row)




Loading…
Cancel
Save