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
This commit is contained in:
@@ -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',
|
||||
|
@@ -47,7 +47,8 @@ class AccessInfoTest(utils.TestCase, testresources.ResourcedTestCase):
|
||||
|
||||
with self.deprecations.expect_deprecations_here():
|
||||
self.assertIsNone(auth_ref.auth_url)
|
||||
self.assertIsNone(auth_ref.management_url)
|
||||
with self.deprecations.expect_deprecations_here():
|
||||
self.assertIsNone(auth_ref.management_url)
|
||||
|
||||
with self.deprecations.expect_deprecations_here():
|
||||
self.assertFalse(auth_ref.scoped)
|
||||
@@ -103,7 +104,9 @@ class AccessInfoTest(utils.TestCase, testresources.ResourcedTestCase):
|
||||
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',))
|
||||
with self.deprecations.expect_deprecations_here():
|
||||
self.assertEqual(auth_ref.management_url,
|
||||
('http://admin:35357/v2.0',))
|
||||
|
||||
self.assertEqual(auth_ref.project_domain_id, 'default')
|
||||
self.assertEqual(auth_ref.project_domain_name, 'Default')
|
||||
|
@@ -51,7 +51,8 @@ class AccessInfoTest(utils.TestCase):
|
||||
|
||||
with self.deprecations.expect_deprecations_here():
|
||||
self.assertIsNone(auth_ref.auth_url)
|
||||
self.assertIsNone(auth_ref.management_url)
|
||||
with self.deprecations.expect_deprecations_here():
|
||||
self.assertIsNone(auth_ref.management_url)
|
||||
|
||||
self.assertFalse(auth_ref.domain_scoped)
|
||||
self.assertFalse(auth_ref.project_scoped)
|
||||
@@ -152,8 +153,9 @@ class AccessInfoTest(utils.TestCase):
|
||||
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',))
|
||||
with self.deprecations.expect_deprecations_here():
|
||||
self.assertEqual(auth_ref.management_url,
|
||||
('http://admin:35357/v3',))
|
||||
|
||||
self.assertEqual(auth_ref.project_domain_id,
|
||||
'4e6893b7ba0b4006840c3845660b86ed')
|
||||
|
Reference in New Issue
Block a user