Merge "keystone: fix catalog output when region is unset"
This commit is contained in:
commit
0d8dab6288
@ -25,7 +25,9 @@ def _format_endpoints(eps=None):
|
|||||||
return ""
|
return ""
|
||||||
ret = ''
|
ret = ''
|
||||||
for index, ep in enumerate(eps):
|
for index, ep in enumerate(eps):
|
||||||
region = eps[index].get('region', '<none>')
|
region = eps[index].get('region')
|
||||||
|
if region is None:
|
||||||
|
region = '<none>'
|
||||||
ret += region + '\n'
|
ret += region + '\n'
|
||||||
for endpoint_type in ['publicURL', 'internalURL', 'adminURL']:
|
for endpoint_type in ['publicURL', 'internalURL', 'adminURL']:
|
||||||
url = eps[index].get(endpoint_type)
|
url = eps[index].get(endpoint_type)
|
||||||
|
@ -25,7 +25,7 @@ def _format_endpoints(eps=None):
|
|||||||
return ""
|
return ""
|
||||||
ret = ''
|
ret = ''
|
||||||
for ep in eps:
|
for ep in eps:
|
||||||
region = ep.get('region_id') or ep.get('region', '<none>')
|
region = ep.get('region_id') or ep.get('region') or '<none>'
|
||||||
ret += region + '\n'
|
ret += region + '\n'
|
||||||
ret += " %s: %s\n" % (ep['interface'], ep['url'])
|
ret += " %s: %s\n" % (ep['interface'], ep['url'])
|
||||||
return ret
|
return ret
|
||||||
|
@ -36,6 +36,12 @@ class TestCatalog(utils.TestCommand):
|
|||||||
'internalURL': 'https://internal.two.example.com',
|
'internalURL': 'https://internal.two.example.com',
|
||||||
'adminURL': 'https://admin.two.example.com',
|
'adminURL': 'https://admin.two.example.com',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
'region': None,
|
||||||
|
'publicURL': 'https://public.none.example.com',
|
||||||
|
'internalURL': 'https://internal.none.example.com',
|
||||||
|
'adminURL': 'https://admin.none.example.com',
|
||||||
|
},
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -87,7 +93,10 @@ class TestCatalogList(TestCatalog):
|
|||||||
'adminURL: https://admin.one.example.com\n'
|
'adminURL: https://admin.one.example.com\n'
|
||||||
'two\n publicURL: https://public.two.example.com\n '
|
'two\n publicURL: https://public.two.example.com\n '
|
||||||
'internalURL: https://internal.two.example.com\n '
|
'internalURL: https://internal.two.example.com\n '
|
||||||
'adminURL: https://admin.two.example.com\n',
|
'adminURL: https://admin.two.example.com\n'
|
||||||
|
'<none>\n publicURL: https://public.none.example.com\n '
|
||||||
|
'internalURL: https://internal.none.example.com\n '
|
||||||
|
'adminURL: https://admin.none.example.com\n',
|
||||||
), )
|
), )
|
||||||
self.assertEqual(datalist, tuple(data))
|
self.assertEqual(datalist, tuple(data))
|
||||||
|
|
||||||
@ -164,7 +173,10 @@ class TestCatalogShow(TestCatalog):
|
|||||||
'adminURL: https://admin.one.example.com\n'
|
'adminURL: https://admin.one.example.com\n'
|
||||||
'two\n publicURL: https://public.two.example.com\n '
|
'two\n publicURL: https://public.two.example.com\n '
|
||||||
'internalURL: https://internal.two.example.com\n '
|
'internalURL: https://internal.two.example.com\n '
|
||||||
'adminURL: https://admin.two.example.com\n',
|
'adminURL: https://admin.two.example.com\n'
|
||||||
|
'<none>\n publicURL: https://public.none.example.com\n '
|
||||||
|
'internalURL: https://internal.none.example.com\n '
|
||||||
|
'adminURL: https://admin.none.example.com\n',
|
||||||
'qwertyuiop',
|
'qwertyuiop',
|
||||||
'supernova',
|
'supernova',
|
||||||
'compute',
|
'compute',
|
||||||
|
@ -38,6 +38,11 @@ class TestCatalog(utils.TestCommand):
|
|||||||
'url': 'https://internal.example.com',
|
'url': 'https://internal.example.com',
|
||||||
'interface': 'internal',
|
'interface': 'internal',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
'region': None,
|
||||||
|
'url': 'https://none.example.com',
|
||||||
|
'interface': 'none',
|
||||||
|
},
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -81,7 +86,8 @@ class TestCatalogList(TestCatalog):
|
|||||||
'compute',
|
'compute',
|
||||||
'onlyone\n public: https://public.example.com\n'
|
'onlyone\n public: https://public.example.com\n'
|
||||||
'onlyone\n admin: https://admin.example.com\n'
|
'onlyone\n admin: https://admin.example.com\n'
|
||||||
'<none>\n internal: https://internal.example.com\n',
|
'<none>\n internal: https://internal.example.com\n'
|
||||||
|
'<none>\n none: https://none.example.com\n',
|
||||||
), )
|
), )
|
||||||
self.assertEqual(datalist, tuple(data))
|
self.assertEqual(datalist, tuple(data))
|
||||||
|
|
||||||
@ -114,7 +120,8 @@ class TestCatalogShow(TestCatalog):
|
|||||||
datalist = (
|
datalist = (
|
||||||
'onlyone\n public: https://public.example.com\nonlyone\n'
|
'onlyone\n public: https://public.example.com\nonlyone\n'
|
||||||
' admin: https://admin.example.com\n'
|
' admin: https://admin.example.com\n'
|
||||||
'<none>\n internal: https://internal.example.com\n',
|
'<none>\n internal: https://internal.example.com\n'
|
||||||
|
'<none>\n none: https://none.example.com\n',
|
||||||
'qwertyuiop',
|
'qwertyuiop',
|
||||||
'supernova',
|
'supernova',
|
||||||
'compute',
|
'compute',
|
||||||
|
Loading…
Reference in New Issue
Block a user