Proper deprecation for AccessInfo auth_url property

Properly deprecate accessing AccessInfo's auth_url parameter.

bp deprecations

Change-Id: I3824904f517434b507587cf73d4389b72f73f22b
This commit is contained in:
Brant Knudson
2015-07-24 10:12:12 -05:00
parent 66fd1eb748
commit 6d82f1f17c
3 changed files with 26 additions and 10 deletions

View File

@@ -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',

View File

@@ -45,7 +45,8 @@ class AccessInfoTest(utils.TestCase, testresources.ResourcedTestCase):
self.assertIsNone(auth_ref.tenant_name)
self.assertIsNone(auth_ref.tenant_id)
self.assertIsNone(auth_ref.auth_url)
with self.deprecations.expect_deprecations_here():
self.assertIsNone(auth_ref.auth_url)
self.assertIsNone(auth_ref.management_url)
with self.deprecations.expect_deprecations_here():
@@ -99,7 +100,9 @@ class AccessInfoTest(utils.TestCase, testresources.ResourcedTestCase):
self.assertEqual(auth_ref.tenant_name, auth_ref.project_name)
self.assertEqual(auth_ref.tenant_id, auth_ref.project_id)
self.assertEqual(auth_ref.auth_url, ('http://public.com:5000/v2.0',))
with self.deprecations.expect_deprecations_here():
self.assertEqual(auth_ref.auth_url,
('http://public.com:5000/v2.0',))
self.assertEqual(auth_ref.management_url, ('http://admin:35357/v2.0',))
self.assertEqual(auth_ref.project_domain_id, 'default')

View File

@@ -49,7 +49,8 @@ class AccessInfoTest(utils.TestCase):
self.assertIsNone(auth_ref.project_name)
self.assertIsNone(auth_ref.project_id)
self.assertIsNone(auth_ref.auth_url)
with self.deprecations.expect_deprecations_here():
self.assertIsNone(auth_ref.auth_url)
self.assertIsNone(auth_ref.management_url)
self.assertFalse(auth_ref.domain_scoped)
@@ -148,8 +149,9 @@ class AccessInfoTest(utils.TestCase):
self.assertEqual(auth_ref.tenant_name, auth_ref.project_name)
self.assertEqual(auth_ref.tenant_id, auth_ref.project_id)
self.assertEqual(auth_ref.auth_url,
('http://public.com:5000/v3',))
with self.deprecations.expect_deprecations_here():
self.assertEqual(auth_ref.auth_url,
('http://public.com:5000/v3',))
self.assertEqual(auth_ref.management_url,
('http://admin:35357/v3',))