summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Pasquier <spasquier@mirantis.com>2017-03-28 09:35:44 +0200
committerSimon Pasquier <spasquier@mirantis.com>2017-03-28 12:48:24 +0000
commitb5a12ffbfa4ce1c482969c2d8f2948e416263d32 (patch)
treeef9dc541c51c3976619d58f6140459596d889b07
parent9040d3e359e3212ca11f3683a858ca7afb4bcb06 (diff)
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
Notes
Notes (review): Code-Review+2: Olivier Bourdon <obourdon@mirantis.com> Workflow+1: Simon Pasquier <spasquier@mirantis.com> Verified+2: Jenkins Submitted-by: Jenkins Submitted-at: Tue, 28 Mar 2017 14:34:13 +0000 Reviewed-on: https://review.openstack.org/450602 Project: openstack/fuel-plugin-lma-collector Branch: refs/heads/master
-rw-r--r--deployment_scripts/puppet/modules/lma_collector/files/collectd/collectd_openstack.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/deployment_scripts/puppet/modules/lma_collector/files/collectd/collectd_openstack.py b/deployment_scripts/puppet/modules/lma_collector/files/collectd/collectd_openstack.py
index 2013b30..ec3b056 100644
--- a/deployment_scripts/puppet/modules/lma_collector/files/collectd/collectd_openstack.py
+++ b/deployment_scripts/puppet/modules/lma_collector/files/collectd/collectd_openstack.py
@@ -104,11 +104,16 @@ class OSClient(object):
104 self.service_catalog = [] 104 self.service_catalog = []
105 for item in data['access']['serviceCatalog']: 105 for item in data['access']['serviceCatalog']:
106 endpoint = item['endpoints'][0] 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 self.service_catalog.append({ 112 self.service_catalog.append({
108 'name': item['name'], 113 'name': item['name'],
109 'region': endpoint['region'], 114 'region': endpoint['region'],
110 'service_type': item['type'], 115 'service_type': item['type'],
111 'url': endpoint['internalURL'], 116 'url': endpoint.get('internalURL', endpoint.get('publicURL')),
112 'admin_url': endpoint['adminURL'], 117 'admin_url': endpoint['adminURL'],
113 }) 118 })
114 119