summaryrefslogtreecommitdiff
path: root/keystoneclient/service_catalog.py
diff options
context:
space:
mode:
authorBrant Knudson <bknudson@us.ibm.com>2015-07-26 07:14:54 -0500
committerBrant Knudson <bknudson@us.ibm.com>2015-08-13 18:57:31 -0500
commit803eb235d50daad27074198effc98ca536f1550f (patch)
tree2bfecfb3358be7c2d51e2f9350a22157dbfd6e15 /keystoneclient/service_catalog.py
parentcba0a6805d424a9f151ab91de1fe19fbd35c2ac9 (diff)
downloadpython-keystoneclient-803eb235d50daad27074198effc98ca536f1550f.tar.gz
Deprecate ServiceCatalog(region_name)
There was a FIXME to deprecate ServiceCatalog's region_name parameter and property. This is now deprecated. Note that debtcollector isn't used here since the deprecation happens on ServiceCatalog's __init__() to catch use in subclasses of ServiceCatalog. ServiceCatalog also has a factory function that constructs the correct instance and the factory function always passes region_name, so it's always using the deprecated kwarg even when region_name isn't passed to the factory. It's not worth figuring out how to do this with debtcollector. bp deprecations Change-Id: I0e64712474ca2767f3c0ade919359132450f6776
Diffstat (limited to 'keystoneclient/service_catalog.py')
-rw-r--r--keystoneclient/service_catalog.py46
1 files changed, 41 insertions, 5 deletions
diff --git a/keystoneclient/service_catalog.py b/keystoneclient/service_catalog.py
index 143a6b7..b8f4ec2 100644
--- a/keystoneclient/service_catalog.py
+++ b/keystoneclient/service_catalog.py
@@ -17,6 +17,7 @@
# limitations under the License.
import abc
+import warnings
import six
@@ -27,11 +28,27 @@ from keystoneclient import utils
@six.add_metaclass(abc.ABCMeta)
class ServiceCatalog(object):
- """Helper methods for dealing with a Keystone Service Catalog."""
+ """Helper methods for dealing with a Keystone Service Catalog.
+
+ .. warning::
+
+ Setting region_name is deprecated in favor of passing the region name
+ as a parameter to calls made to the service catalog as of the 1.7.0
+ release and may be removed in the 2.0.0 release.
+
+ """
@classmethod
def factory(cls, resource_dict, token=None, region_name=None):
- """Create ServiceCatalog object given an auth token."""
+ """Create ServiceCatalog object given an auth token.
+
+ .. warning::
+
+ Setting region_name is deprecated in favor of passing the region
+ name as a parameter to calls made to the service catalog as of the
+ 1.7.0 release and may be removed in the 2.0.0 release.
+
+ """
if ServiceCatalogV3.is_valid(resource_dict):
return ServiceCatalogV3(token, resource_dict, region_name)
elif ServiceCatalogV2.is_valid(resource_dict):
@@ -40,13 +57,32 @@ class ServiceCatalog(object):
raise NotImplementedError(_('Unrecognized auth response'))
def __init__(self, region_name=None):
+ if region_name:
+ warnings.warn(
+ 'Setting region_name on the service catalog is deprecated in '
+ 'favor of passing the region name as a parameter to calls '
+ 'made to the service catalog as of the 1.7.0 release and may '
+ 'be removed in the 2.0.0 release.',
+ DeprecationWarning)
+
self._region_name = region_name
@property
def region_name(self):
- # FIXME(jamielennox): Having region_name set on the service catalog
- # directly is deprecated. It should instead be provided as a parameter
- # to calls made to the service_catalog. Provide appropriate warning.
+ """Region name.
+
+ .. warning::
+
+ region_name is deprecated in favor of passing the region name as a
+ parameter to calls made to the service catalog as of the 1.7.0
+ release and may be removed in the 2.0.0 release.
+
+ """
+ warnings.warn(
+ 'region_name is deprecated in favor of passing the region name as '
+ 'a parameter to calls made to the service catalog as of the 1.7.0 '
+ 'release and may be removed in the 2.0.0 release.',
+ DeprecationWarning)
return self._region_name
def _get_endpoint_region(self, endpoint):