diff --git a/ovsdbapp/impl_idl.py b/ovsdbapp/impl_idl.py index 899693ee..165441cf 100644 --- a/ovsdbapp/impl_idl.py +++ b/ovsdbapp/impl_idl.py @@ -16,7 +16,6 @@ import logging import time from ovsdbapp import exceptions -from oslo_utils import excutils from ovs.db import idl from six.moves import queue as Queue @@ -96,10 +95,9 @@ class Transaction(api.Transaction): try: command.run_idl(txn) except Exception: - with excutils.save_and_reraise_exception() as ctx: - txn.abort() - if not self.check_error: - ctx.reraise = False + txn.abort() + if self.check_error: + raise seqno = self.api.idl.change_seqno status = txn.commit_block() if status == txn.TRY_AGAIN: diff --git a/ovsdbapp/native/commands.py b/ovsdbapp/native/commands.py index 97a1ddeb..e693bf39 100644 --- a/ovsdbapp/native/commands.py +++ b/ovsdbapp/native/commands.py @@ -15,7 +15,6 @@ import collections import logging -from oslo_utils import excutils import six from ovsdbapp import api @@ -35,11 +34,10 @@ class BaseCommand(api.Command): txn.add(self) return self.result except Exception: - with excutils.save_and_reraise_exception() as ctx: - if log_errors: - LOG.exception("Error executing command") - if not check_error: - ctx.reraise = False + if log_errors: + LOG.exception("Error executing command") + if check_error: + raise def post_commit(self, txn): pass diff --git a/ovsdbapp/native/idlutils.py b/ovsdbapp/native/idlutils.py index 1066f462..523662ab 100644 --- a/ovsdbapp/native/idlutils.py +++ b/ovsdbapp/native/idlutils.py @@ -18,7 +18,6 @@ import time import uuid from ovsdbapp import exceptions -from oslo_utils import excutils from ovs.db import idl from ovs import jsonrpc from ovs import poller @@ -117,24 +116,25 @@ def _get_schema_helper(connection, schema_name): return idl.SchemaHelper(None, resp.result) -def get_schema_helper(connection, schema_name, retry=True): +def get_schema_helper(connection, schema_name, + retry=True, try_add_manager=True): try: return _get_schema_helper(connection, schema_name) except Exception: - with excutils.save_and_reraise_exception(reraise=False) as ctx: - if not retry: - ctx.reraise = True - # We may have failed due to set-manager not being called + if not retry: + raise + # We may have failed due to set-manager not being called + if try_add_manager: helpers.enable_connection_uri(connection) - # There is a small window for a race, so retry up to a second - @tenacity.retry(wait=tenacity.wait_exponential(multiplier=0.01), - stop=tenacity.stop_after_delay(1), - reraise=True) - def do_get_schema_helper(): - return _get_schema_helper(connection, schema_name) + # There is a small window for a race, so retry up to a second + @tenacity.retry(wait=tenacity.wait_exponential(multiplier=0.01), + stop=tenacity.stop_after_delay(1), + reraise=True) + def do_get_schema_helper(): + return _get_schema_helper(connection, schema_name) - return do_get_schema_helper() + return do_get_schema_helper() def wait_for_change(_idl, timeout, seqno=None):