OpenStack catalog URLs are not the same in all commands results
Environment
- Red Hat OpenStack 6.0
Issue
When execute the "openstack catalog list
" command the publicURL
, internalURL
and the adminURL
are always the same for a specific service. However when execute the "keystone catalog
" command these URLs are different.
Resolution
A fix for this issue has been released with RHBA-2016-0642
Diagnostic Steps
Issue can be seen when using OSP installer where every endpoint gets its own VIP.
identity/v2_0/catalog.py
26 def _format_endpoints(eps=None):
27 if not eps:
28 return ""
29 for index, ep in enumerate(eps):
30 ret = eps[index]['region'] + '\n'
31 for url in ['publicURL', 'internalURL', 'adminURL']:
--> 32 ret += " %s: %s\n" % (url, eps[index]['publicURL']) <-- always returns publicURL
33 return ret
34
35
36 class ListCatalog(lister.Lister):
37 """List services in the service catalog"""
38
39 log = logging.getLogger(__name__ + '.ListCatalog')
40
41 def take_action(self, parsed_args):
42 self.log.debug('take_action(%s)', parsed_args)
43
44 # This is ugly because if auth hasn't happened yet we need
45 # to trigger it here.
46 sc = self.app.client_manager.session.auth.get_auth_ref(
47 self.app.client_manager.session,
48 ).service_catalog
49
50 data = sc.get_data()
51 columns = ('Name', 'Type', 'Endpoints')
52 return (columns,
53 (utils.get_dict_properties(
54 s, columns,
55 formatters={
56 'Endpoints': _format_endpoints,
57 },
58 ) for s in data))
Patch to fix this issue:
# diff -u /usr/lib/python2.7/site-packages/openstackclient/identity/v2_0/catalog.py.org /usr/lib/python2.7/site-packages/openstackclient/identity/v2_0/catalog.py
--- /usr/lib/python2.7/site-packages/openstackclient/identity/v2_0/catalog.py.org 2015-06-29 22:01:34.154048838 +0200
+++ /usr/lib/python2.7/site-packages/openstackclient/identity/v2_0/catalog.py 2015-06-29 22:04:18.701144884 +0200
@@ -29,7 +29,7 @@
for index, ep in enumerate(eps):
ret = eps[index]['region'] + '\n'
for url in ['publicURL', 'internalURL', 'adminURL']:
- ret += " %s: %s\n" % (url, eps[index]['publicURL'])
+ ret += " %s: %s\n" % (url, eps[index][url])
return ret
Before:
openstack catalog list
+------------+---------------+----------------------------------------------------------------------------+
| Name | Type | Endpoints |
+------------+---------------+----------------------------------------------------------------------------+
| nova | compute | RegionOne |
| | | publicURL: http://172.26.0.95:8774/v2/4d802f09ea1e4bfc81642e41e597bfa4 |
| | | internalURL: http://172.26.0.95:8774/v2/4d802f09ea1e4bfc81642e41e597bfa4 |
| | | adminURL: http://172.26.0.95:8774/v2/4d802f09ea1e4bfc81642e41e597bfa4 |
keystone catalog
Service: compute
+-------------+-------------------------------------------------------------+
| Property | Value |
+-------------+-------------------------------------------------------------+
| adminURL | http://172.26.0.93:8774/v2/4d802f09ea1e4bfc81642e41e597bfa4 |
| id | 43bbb336eec64564a8aad543eddda20e |
| internalURL | http://172.26.0.94:8774/v2/4d802f09ea1e4bfc81642e41e597bfa4 |
| publicURL | http://172.26.0.95:8774/v2/4d802f09ea1e4bfc81642e41e597bfa4 |
| region | RegionOne |
+-------------+-------------------------------------------------------------+
After:
openstack catalog list
+------------+---------------+----------------------------------------------------------------------------+
| Name | Type | Endpoints |
+------------+---------------+----------------------------------------------------------------------------+
| nova | compute | RegionOne |
| | | publicURL: http://172.26.0.95:8774/v2/4d802f09ea1e4bfc81642e41e597bfa4 |
| | | internalURL: http://172.26.0.94:8774/v2/4d802f09ea1e4bfc81642e41e597bfa4 |
| | | adminURL: http://172.26.0.93:8774/v2/4d802f09ea1e4bfc81642e41e597bfa4 |
keystone catalog
Service: compute
+-------------+-------------------------------------------------------------+
| Property | Value |
+-------------+-------------------------------------------------------------+
| adminURL | http://172.26.0.93:8774/v2/4d802f09ea1e4bfc81642e41e597bfa4 |
| id | 43bbb336eec64564a8aad543eddda20e |
| internalURL | http://172.26.0.94:8774/v2/4d802f09ea1e4bfc81642e41e597bfa4 |
| publicURL | http://172.26.0.95:8774/v2/4d802f09ea1e4bfc81642e41e597bfa4 |
| region | RegionOne |
+-------------+-------------------------------------------------------------+
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.
Comments