diff options
author | Stephen Finucane <stephenfin@redhat.com> | 2018-10-17 13:59:36 +0100 |
---|---|---|
committer | Stephen Finucane <stephenfin@redhat.com> | 2018-10-17 14:04:42 +0100 |
commit | 1f0f5654a71b71aabfda862f477df0e9415080bb (patch) | |
tree | a7af28251d32db7728e785b78994f8c7a33c79be /oslo_db/sqlalchemy | |
parent | baa0a045b51fd261fdcef6f7dfafe8e823f26e7a (diff) | |
download | oslo-db-1f0f5654a71b71aabfda862f477df0e9415080bb.tar.gz |
Move warnings to their own module
Raising warnings from an exception module can result in a rather
confusing message:
Running command: '/usr/bin/nova-scheduler '
/.../sqlalchemy/enginefacade.py:332: NotSupportedWarning: Configuration option(s) ['use_tpool'] not supported
exception.NotSupportedWarning
For someone not used to Python's 'warning' infrastructure, this can look
worse than it is, as seen at [1].
While this particular warning was resolved in change I4a5f8958c3e, it's
possible that a similar warning could be raised for other options. Best
to move this out of the 'exception' module and into something more
sensible.
[1] https://bugzilla.redhat.com/show_bug.cgi?id=1639423
Change-Id: I8e0480fb11123067a111ed6aeda6b47614615645
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Diffstat (limited to 'oslo_db/sqlalchemy')
-rw-r--r-- | oslo_db/sqlalchemy/enginefacade.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/oslo_db/sqlalchemy/enginefacade.py b/oslo_db/sqlalchemy/enginefacade.py index 481e166..0e2ac70 100644 --- a/oslo_db/sqlalchemy/enginefacade.py +++ b/oslo_db/sqlalchemy/enginefacade.py @@ -10,7 +10,6 @@ # License for the specific language governing permissions and limitations # under the License. - import contextlib import functools import operator @@ -28,6 +27,7 @@ from oslo_db import options from oslo_db.sqlalchemy import engines from oslo_db.sqlalchemy import orm from oslo_db.sqlalchemy import utils +from oslo_db import warning class _symbol(object): @@ -334,7 +334,7 @@ class _TransactionFactory(object): warnings.warn( "Configuration option(s) %r not supported" % sorted(not_supported), - exception.NotSupportedWarning + warning.NotSupportedWarning ) def get_legacy_facade(self): @@ -1253,7 +1253,7 @@ class LegacyEngineFacade(object): warnings.warn( "EngineFacade is deprecated; please use " "oslo_db.sqlalchemy.enginefacade", - exception.OsloDBDeprecationWarning, + warning.OsloDBDeprecationWarning, stacklevel=2) if _factory: self._factory = _factory |