Avoid cloudwatch endpoint retrieve when disabled

If openstack-api-cloudwatch service is disabled in a
deployment these lines of code will provoke a
traceback when trying to get the cloudwatch
end-point.

Change-Id: I7257f79af764cddc16423826143b0d8babfe54e7
Partial-Bug: #1715083
This commit is contained in:
Jose Luis Franco Arza 2017-09-12 13:17:04 +02:00
parent 64e8c7619f
commit d14d9202e3
1 changed files with 8 additions and 7 deletions

View File

@ -393,14 +393,15 @@ echo -e '%s\tALL=(ALL)\tNOPASSWD: ALL' >> /etc/sudoers
attachments.append((jsonutils.dumps(metadata),
'cfn-init-data', 'x-cfninitdata'))
heat_client_plugin = self.context.clients.client_plugin('heat')
watch_url = cfg.CONF.heat_watch_server_url
if not watch_url:
watch_url = heat_client_plugin.get_watch_server_url()
attachments.append((watch_url, 'cfn-watch-server', 'x-cfninitdata'))
if is_cfntools:
heat_client_plugin = self.context.clients.client_plugin('heat')
watch_url = cfg.CONF.heat_watch_server_url
if not watch_url:
watch_url = heat_client_plugin.get_watch_server_url()
attachments.append((watch_url,
'cfn-watch-server', 'x-cfninitdata'))
cfn_md_url = heat_client_plugin.get_cfn_metadata_server_url()
attachments.append((cfn_md_url,
'cfn-metadata-server', 'x-cfninitdata'))