54b257220f
We were using logging.warning() to warn the user about fields that had been removed in recent API versions or behavior that was now considered deprecated in SDK. This was the wrong API to use. We shouldn't have been logging, we have been using 'warnings'. From the Python docs [1]: Task you want to perform: Issue a warning regarding a particular runtime event warnings.warn() in library code if the issue is avoidable and the client application should be modified to eliminate the warning logging.warning() if there is nothing the client application can do about the situation, but the event should still be noted Based on this, introduce a new module, 'openstack.warnings', containing a number of custom 'DeprecationWarning' subclasses. 'DeprecationWarning' isn't show by default in most cases [2] but users can opt-in to showing them and do so selectively. For example, they may wish to ignore warnings about fields that have been removed in recent API versions while raising errors if they are relying on deprecated SDK behavior. [1] https://docs.python.org/3/howto/logging.html#when-to-use-logging [2] https://docs.python.org/3/library/exceptions.html#DeprecationWarning Change-Id: I3846e8fcffdb5de2afe64365952d90b5ecb0f74a Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
8 lines
262 B
YAML
8 lines
262 B
YAML
---
|
|
upgrade:
|
|
- |
|
|
Warnings about deprecated behavior or deprecated/modified APIs are now
|
|
raised using the ``warnings`` module, rather than the ``logging`` module.
|
|
This allows users to filter these warnings or silence them entirely if
|
|
necessary.
|