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).
|
authentication request wasn't scoped to a tenant (project).
|
||||||
|
|
||||||
DEPRECATED: this doesn't correctly handle region name. You should fetch
|
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
|
:returns: tuple of urls
|
||||||
"""
|
"""
|
||||||
@@ -628,8 +629,13 @@ class AccessInfoV2(AccessInfo):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def management_url(self):
|
def management_url(self):
|
||||||
# FIXME(jamielennox): this is deprecated in favour of retrieving it
|
"""Deprecated as of the 1.7.0 release in favor of
|
||||||
# from the service catalog. Provide a warning.
|
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:
|
if self.service_catalog:
|
||||||
return self.service_catalog.get_urls(service_type='identity',
|
return self.service_catalog.get_urls(service_type='identity',
|
||||||
endpoint_type='adminURL',
|
endpoint_type='adminURL',
|
||||||
@@ -826,8 +832,13 @@ class AccessInfoV3(AccessInfo):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def management_url(self):
|
def management_url(self):
|
||||||
# FIXME(jamielennox): this is deprecated in favour of retrieving it
|
"""Deprecated as of the 1.7.0 release in favor of
|
||||||
# from the service catalog. Provide a warning.
|
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:
|
if self.service_catalog:
|
||||||
return self.service_catalog.get_urls(service_type='identity',
|
return self.service_catalog.get_urls(service_type='identity',
|
||||||
endpoint_type='admin',
|
endpoint_type='admin',
|
||||||
|
@@ -47,6 +47,7 @@ class AccessInfoTest(utils.TestCase, testresources.ResourcedTestCase):
|
|||||||
|
|
||||||
with self.deprecations.expect_deprecations_here():
|
with self.deprecations.expect_deprecations_here():
|
||||||
self.assertIsNone(auth_ref.auth_url)
|
self.assertIsNone(auth_ref.auth_url)
|
||||||
|
with self.deprecations.expect_deprecations_here():
|
||||||
self.assertIsNone(auth_ref.management_url)
|
self.assertIsNone(auth_ref.management_url)
|
||||||
|
|
||||||
with self.deprecations.expect_deprecations_here():
|
with self.deprecations.expect_deprecations_here():
|
||||||
@@ -103,7 +104,9 @@ class AccessInfoTest(utils.TestCase, testresources.ResourcedTestCase):
|
|||||||
with self.deprecations.expect_deprecations_here():
|
with self.deprecations.expect_deprecations_here():
|
||||||
self.assertEqual(auth_ref.auth_url,
|
self.assertEqual(auth_ref.auth_url,
|
||||||
('http://public.com:5000/v2.0',))
|
('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_id, 'default')
|
||||||
self.assertEqual(auth_ref.project_domain_name, 'Default')
|
self.assertEqual(auth_ref.project_domain_name, 'Default')
|
||||||
|
@@ -51,6 +51,7 @@ class AccessInfoTest(utils.TestCase):
|
|||||||
|
|
||||||
with self.deprecations.expect_deprecations_here():
|
with self.deprecations.expect_deprecations_here():
|
||||||
self.assertIsNone(auth_ref.auth_url)
|
self.assertIsNone(auth_ref.auth_url)
|
||||||
|
with self.deprecations.expect_deprecations_here():
|
||||||
self.assertIsNone(auth_ref.management_url)
|
self.assertIsNone(auth_ref.management_url)
|
||||||
|
|
||||||
self.assertFalse(auth_ref.domain_scoped)
|
self.assertFalse(auth_ref.domain_scoped)
|
||||||
@@ -152,6 +153,7 @@ class AccessInfoTest(utils.TestCase):
|
|||||||
with self.deprecations.expect_deprecations_here():
|
with self.deprecations.expect_deprecations_here():
|
||||||
self.assertEqual(auth_ref.auth_url,
|
self.assertEqual(auth_ref.auth_url,
|
||||||
('http://public.com:5000/v3',))
|
('http://public.com:5000/v3',))
|
||||||
|
with self.deprecations.expect_deprecations_here():
|
||||||
self.assertEqual(auth_ref.management_url,
|
self.assertEqual(auth_ref.management_url,
|
||||||
('http://admin:35357/v3',))
|
('http://admin:35357/v3',))
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user