Browse Source

Fix collectd plugins when 'internalURL' isn't set

It is possible to register a service in the Keystone catalog without
internalURL. This change fixes the collectd plugins to support that
configuration.

Change-Id: Id5ef3c4fcd473b92855cb656a80435d670062cfb
Closes-Bug: #1676755
changes/02/450602/4
Simon Pasquier 2 years ago
parent
commit
b5a12ffbfa

+ 6
- 1
deployment_scripts/puppet/modules/lma_collector/files/collectd/collectd_openstack.py View File

@@ -104,11 +104,16 @@ class OSClient(object):
104 104
         self.service_catalog = []
105 105
         for item in data['access']['serviceCatalog']:
106 106
             endpoint = item['endpoints'][0]
107
+            if 'internalURL' not in endpoint and 'publicURL' not in endpoint:
108
+                self.logger.warning(
109
+                    "Service '{}' skipped because no URL can be found".format(
110
+                        item['name']))
111
+                continue
107 112
             self.service_catalog.append({
108 113
                 'name': item['name'],
109 114
                 'region': endpoint['region'],
110 115
                 'service_type': item['type'],
111
-                'url': endpoint['internalURL'],
116
+                'url': endpoint.get('internalURL', endpoint.get('publicURL')),
112 117
                 'admin_url': endpoint['adminURL'],
113 118
             })
114 119
 

Loading…
Cancel
Save