From 8d65259cb887c0a4f9c26d3994aef131633c5189 Mon Sep 17 00:00:00 2001 From: Brant Knudson Date: Fri, 24 Jul 2015 08:15:46 -0500 Subject: Proper deprecation for AccessInfo region_name parameter Properly deprecate constructing AccessInfo with region_name parameter. bp deprecations Change-Id: Ic5f48a4f5354beb8be68c2fd788bf0a974501917 --- keystoneclient/access.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'keystoneclient/access.py') diff --git a/keystoneclient/access.py b/keystoneclient/access.py index 009b72e..881f4c0 100644 --- a/keystoneclient/access.py +++ b/keystoneclient/access.py @@ -16,6 +16,7 @@ import datetime +import warnings from oslo_utils import timeutils @@ -39,9 +40,20 @@ class AccessInfo(dict): **kwargs): """Create AccessInfo object given a successful auth response & body or a user-provided dict. + + .. warning:: + + Use of the region_name argument is deprecated as of the 1.7.0 + release and may be removed in the 2.0.0 release. + """ - # FIXME(jamielennox): Passing region_name is deprecated. Provide an - # appropriate warning. + + if region_name: + warnings.warn( + 'Use of the region_name argument is deprecated as of the ' + '1.7.0 release and may be removed in the 2.0.0 release.', + DeprecationWarning) + auth_ref = None if body is not None or len(kwargs): -- cgit v1.2.1 From f782ee853c49dda7f86055192a01c75269e26aff Mon Sep 17 00:00:00 2001 From: Brant Knudson Date: Fri, 24 Jul 2015 09:10:49 -0500 Subject: Proper deprecation for AccessInfo scoped property Properly deprecate constructing AccessInfo's scoped parameter. bp deprecations Change-Id: I8f81c75eb8e758feb9d4c62ce7f041957562e766 --- keystoneclient/access.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'keystoneclient/access.py') diff --git a/keystoneclient/access.py b/keystoneclient/access.py index 881f4c0..576312b 100644 --- a/keystoneclient/access.py +++ b/keystoneclient/access.py @@ -258,7 +258,10 @@ class AccessInfo(dict): """Returns true if the authorization token was scoped to a tenant (project), and contains a populated service catalog. - This is deprecated, use project_scoped instead. + .. warning:: + + This is deprecated as of the 1.7.0 release in favor of + project_scoped and may be removed in the 2.0.0 release. :returns: bool """ @@ -537,6 +540,13 @@ class AccessInfoV2(AccessInfo): @property def scoped(self): + """Deprecated as of the 1.7.0 release in favor of project_scoped and + may be removed in the 2.0.0 release. + """ + warnings.warn( + 'scoped is deprecated as of the 1.7.0 release in favor of ' + 'project_scoped and may be removed in the 2.0.0 release.', + DeprecationWarning) if ('serviceCatalog' in self and self['serviceCatalog'] and 'tenant' in self['token']): @@ -759,6 +769,13 @@ class AccessInfoV3(AccessInfo): @property def scoped(self): + """Deprecated as of the 1.7.0 release in favor of project_scoped and + may be removed in the 2.0.0 release. + """ + warnings.warn( + 'scoped is deprecated as of the 1.7.0 release in favor of ' + 'project_scoped and may be removed in the 2.0.0 release.', + DeprecationWarning) return ('catalog' in self and self['catalog'] and 'project' in self) @property -- cgit v1.2.1 From 6d82f1f17ca99b4e318b6c5bfa24b6dc507ba497 Mon Sep 17 00:00:00 2001 From: Brant Knudson Date: Fri, 24 Jul 2015 10:12:12 -0500 Subject: Proper deprecation for AccessInfo auth_url property Properly deprecate accessing AccessInfo's auth_url parameter. bp deprecations Change-Id: I3824904f517434b507587cf73d4389b72f73f22b --- keystoneclient/access.py | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'keystoneclient/access.py') diff --git a/keystoneclient/access.py b/keystoneclient/access.py index 576312b..ee90f0e 100644 --- a/keystoneclient/access.py +++ b/keystoneclient/access.py @@ -364,7 +364,8 @@ class AccessInfo(dict): (project), this property will return None. DEPRECATED: this doesn't correctly handle region name. You should fetch - it from the service catalog yourself. + it from the service catalog yourself. This may be removed in the 2.0.0 + release. :returns: tuple of urls """ @@ -611,8 +612,13 @@ class AccessInfoV2(AccessInfo): @property def auth_url(self): - # FIXME(jamielennox): this is deprecated in favour of retrieving it - # from the service catalog. Provide a warning. + """Deprecated as of the 1.7.0 release in favor of + service_catalog.get_urls() and may be removed in the 2.0.0 release. + """ + warnings.warn( + 'auth_url is deprecated as of the 1.7.0 release in favor of ' + 'service_catalog.get_urls() and may be removed in the 2.0.0 ' + 'release.', DeprecationWarning) if self.service_catalog: return self.service_catalog.get_urls(service_type='identity', endpoint_type='publicURL', @@ -804,8 +810,13 @@ class AccessInfoV3(AccessInfo): @property def auth_url(self): - # FIXME(jamielennox): this is deprecated in favour of retrieving it - # from the service catalog. Provide a warning. + """Deprecated as of the 1.7.0 release in favor of + service_catalog.get_urls() and may be removed in the 2.0.0 release. + """ + warnings.warn( + 'auth_url is deprecated as of the 1.7.0 release in favor of ' + 'service_catalog.get_urls() and may be removed in the 2.0.0 ' + 'release.', DeprecationWarning) if self.service_catalog: return self.service_catalog.get_urls(service_type='identity', endpoint_type='public', -- cgit v1.2.1 From 1a2ccb001bdbb09a3b66c6aca651ce71e62734d8 Mon Sep 17 00:00:00 2001 From: Brant Knudson Date: Fri, 24 Jul 2015 10:51:49 -0500 Subject: Proper deprecation for AccessInfo management_url property AccessInfo's management_url parameter wasn't properly deprecated since all it had was a comment in the code. Proper deprecation requires use of warnings and documentation. bp deprecations Change-Id: I0ee07c5adc6a7c91f8b23b291eea76f4ae7b3b89 --- keystoneclient/access.py | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'keystoneclient/access.py') diff --git a/keystoneclient/access.py b/keystoneclient/access.py index ee90f0e..f308a58 100644 --- a/keystoneclient/access.py +++ b/keystoneclient/access.py @@ -378,7 +378,8 @@ class AccessInfo(dict): authentication request wasn't scoped to a tenant (project). DEPRECATED: this doesn't correctly handle region name. You should fetch - it from the service catalog yourself. + it from the service catalog yourself. This may be removed in the 2.0.0 + release. :returns: tuple of urls """ @@ -628,8 +629,13 @@ class AccessInfoV2(AccessInfo): @property def management_url(self): - # FIXME(jamielennox): this is deprecated in favour of retrieving it - # from the service catalog. Provide a warning. + """Deprecated as of the 1.7.0 release in favor of + service_catalog.get_urls() and may be removed in the 2.0.0 release. + """ + warnings.warn( + 'management_url is deprecated as of the 1.7.0 release in favor of ' + 'service_catalog.get_urls() and may be removed in the 2.0.0 ' + 'release.', DeprecationWarning) if self.service_catalog: return self.service_catalog.get_urls(service_type='identity', endpoint_type='adminURL', @@ -826,8 +832,13 @@ class AccessInfoV3(AccessInfo): @property def management_url(self): - # FIXME(jamielennox): this is deprecated in favour of retrieving it - # from the service catalog. Provide a warning. + """Deprecated as of the 1.7.0 release in favor of + service_catalog.get_urls() and may be removed in the 2.0.0 release. + """ + warnings.warn( + 'management_url is deprecated as of the 1.7.0 release in favor of ' + 'service_catalog.get_urls() and may be removed in the 2.0.0 ' + 'release.', DeprecationWarning) if self.service_catalog: return self.service_catalog.get_urls(service_type='identity', endpoint_type='admin', -- cgit v1.2.1