From b5d20a0718c4b5cc5537a5efe6be5bd277f85389 Mon Sep 17 00:00:00 2001 From: Corey Bryant Date: Thu, 1 Aug 2019 22:59:46 -0400 Subject: [PATCH] Sync charm-helpers and use "rabbit_use_ssl" for ocata Ensure "rabbit_use_ssl" is specified in the [oslo_messaging_rabbit] config section instead of "ssl" for Ocata, since "ssl" was not yet introduced. Change-Id: I070b8bbebed4e53fa524047599c71f73dc1c79fc Closes-Bug: #1838696 --- charmhelpers/contrib/openstack/ha/utils.py | 27 +++++++++---------- .../section-oslo-messaging-rabbit-ocata | 10 +++++++ templates/ocata/cinder.conf | 2 +- 3 files changed, 24 insertions(+), 15 deletions(-) create mode 100644 charmhelpers/contrib/openstack/templates/section-oslo-messaging-rabbit-ocata diff --git a/charmhelpers/contrib/openstack/ha/utils.py b/charmhelpers/contrib/openstack/ha/utils.py index 718c6d65..07d37b0a 100644 --- a/charmhelpers/contrib/openstack/ha/utils.py +++ b/charmhelpers/contrib/openstack/ha/utils.py @@ -127,7 +127,9 @@ def expect_ha(): return len(ha_related_units) > 0 or config('vip') or config('dns-ha') -def generate_ha_relation_data(service, extra_settings=None): +def generate_ha_relation_data(service, + extra_settings=None, + haproxy_enabled=True): """ Generate relation data for ha relation Based on configuration options and unit interfaces, generate a json @@ -152,21 +154,18 @@ def generate_ha_relation_data(service, extra_settings=None): @param extra_settings: Dict of additional resource data @returns dict: json encoded data for use with relation_set """ - _haproxy_res = 'res_{}_haproxy'.format(service) - _relation_data = { - 'resources': { - _haproxy_res: 'lsb:haproxy', - }, - 'resource_params': { + _relation_data = {'resources': {}, 'resource_params': {}} + + if haproxy_enabled: + _haproxy_res = 'res_{}_haproxy'.format(service) + _relation_data['resources'] = {_haproxy_res: 'lsb:haproxy'} + _relation_data['resource_params'] = { _haproxy_res: 'op monitor interval="5s"' - }, - 'init_services': { - _haproxy_res: 'haproxy' - }, - 'clones': { + } + _relation_data['init_services'] = {_haproxy_res: 'haproxy'} + _relation_data['clones'] = { 'cl_{}_haproxy'.format(service): _haproxy_res - }, - } + } if extra_settings: for k, v in extra_settings.items(): diff --git a/charmhelpers/contrib/openstack/templates/section-oslo-messaging-rabbit-ocata b/charmhelpers/contrib/openstack/templates/section-oslo-messaging-rabbit-ocata new file mode 100644 index 00000000..365f4375 --- /dev/null +++ b/charmhelpers/contrib/openstack/templates/section-oslo-messaging-rabbit-ocata @@ -0,0 +1,10 @@ +[oslo_messaging_rabbit] +{% if rabbitmq_ha_queues -%} +rabbit_ha_queues = True +{% endif -%} +{% if rabbit_ssl_port -%} +rabbit_use_ssl = True +{% endif -%} +{% if rabbit_ssl_ca -%} +ssl_ca_file = {{ rabbit_ssl_ca }} +{% endif -%} diff --git a/templates/ocata/cinder.conf b/templates/ocata/cinder.conf index 5496b814..24567405 100644 --- a/templates/ocata/cinder.conf +++ b/templates/ocata/cinder.conf @@ -55,7 +55,7 @@ volume_usage_audit_period = {{ volume_usage_audit_period }} {% include "parts/section-database" %} -{% include "section-oslo-messaging-rabbit" %} +{% include "section-oslo-messaging-rabbit-ocata" %} {% include "section-oslo-notifications" %}