Put 'db' parameter back and provide a deprecation warning before remove

The parameter should have been deprecated before its removal to give
callers a chance to adjust their calls to the new argument list.

This patchset follows Ben Nemec's comment in commit
https://review.openstack.org/#/c/569078/

Change-Id: I606796a33f6304276fe78b9868239a0ee5b9f46a
This commit is contained in:
Nguyen Van Duc 2018-06-11 17:26:24 +07:00 committed by Tovin Seven
parent 4a2f002005
commit 5ea78ce950
1 changed files with 12 additions and 2 deletions

View File

@ -14,6 +14,8 @@
# License for the specific language governing permissions and limitations
# under the License.
from debtcollector import removals
from oslo_config import cfg
from oslo_serialization import jsonutils
import six.moves.urllib.parse as parser
@ -23,7 +25,11 @@ from osprofiler import exc
class Redis(base.Driver):
def __init__(self, connection_str, project=None,
@removals.removed_kwarg("db", message="'db' parameter is deprecated "
"and will be removed in future. "
"Please specify 'db' in "
"'connection_string' instead.")
def __init__(self, connection_str, db=0, project=None,
service=None, host=None, conf=cfg.CONF, **kwargs):
"""Redis driver for OSProfiler."""
@ -146,7 +152,11 @@ class Redis(base.Driver):
class RedisSentinel(Redis, base.Driver):
def __init__(self, connection_str, project=None,
@removals.removed_kwarg("db", message="'db' parameter is deprecated "
"and will be removed in future. "
"Please specify 'db' in "
"'connection_string' instead.")
def __init__(self, connection_str, db=0, project=None,
service=None, host=None, conf=cfg.CONF, **kwargs):
"""Redis driver for OSProfiler."""