Support dict values for the notification parameter
This change allows to configure the notification topic(s) and messaging
driver. It preserves backward-compatibility when the 'notification'
parameter is a boolean value instead of a dict.
Change-Id: Ia317577630da0d78e2abd84f76446bfb27aba565
diff --git a/glance/files/liberty/glance-api.conf.Debian b/glance/files/liberty/glance-api.conf.Debian
index 6dad168..98c2841 100644
--- a/glance/files/liberty/glance-api.conf.Debian
+++ b/glance/files/liberty/glance-api.conf.Debian
@@ -241,10 +241,17 @@
# Messaging driver used for 'messaging' notifications driver
# rpc_backend = 'rabbit'
+{%- if server.notification is mapping %}
+notification_driver = {{ server.notification.get('driver', 'messagingv2') }}
+rabbit_notification_topic = {{ server.notification.get('topics', 'notifications') }}
+{%- elif server.notification %}
+notification_driver = messagingv2
+rabbit_notification_topic = notifications
+{%- endif %}
+
{% if server.notification %}
rpc_backend = rabbit
notifier_strategy=rabbit
-notification_driver = messagingv2
# Configuration options if sending notifications via rabbitmq (these are
# the defaults)
#
@@ -263,7 +270,6 @@
rabbit_password = {{ server.message_queue.password }}
rabbit_virtual_host = {{ server.message_queue.virtual_host }}
rabbit_notification_exchange = glance
-rabbit_notification_topic = notifications
#rabbit_durable_queues = False
{% else %}
diff --git a/glance/files/liberty/glance-registry.conf.Debian b/glance/files/liberty/glance-registry.conf.Debian
index a87bd38..b737a28 100644
--- a/glance/files/liberty/glance-registry.conf.Debian
+++ b/glance/files/liberty/glance-registry.conf.Debian
@@ -90,10 +90,17 @@
# Driver or drivers to handle sending notifications. Set to
# 'messaging' to send notifications to a message queue.
# notification_driver = noop
+{%- if server.notification is mapping %}
+notification_driver = {{ server.notification.get('driver', 'messagingv2') }}
+rabbit_notification_topic = {{ server.notification.get('topics', 'notifications') }}
+{%- elif server.notification %}
+notification_driver = messagingv2
+rabbit_notification_topic = notifications
+{%- endif %}
+
{% if server.notification %}
rpc_backend = rabbit
notifier_strategy = rabbit
-notification_driver = messagingv2
{%- if server.message_queue.members is defined %}
rabbit_hosts = {% for member in server.message_queue.members -%}
@@ -110,7 +117,6 @@
rabbit_password = {{ server.message_queue.password }}
rabbit_virtual_host = {{ server.message_queue.virtual_host }}
rabbit_notification_exchange = glance
-rabbit_notification_topic = notifications
rabbit_durable_queues = False
{% endif %}
diff --git a/glance/files/mitaka/glance-api.conf.Debian b/glance/files/mitaka/glance-api.conf.Debian
index d0055a4..ed410f8 100644
--- a/glance/files/mitaka/glance-api.conf.Debian
+++ b/glance/files/mitaka/glance-api.conf.Debian
@@ -1439,9 +1439,14 @@
# messaging, messagingv2, routing, log, test, noop (multi valued)
# Deprecated group/name - [DEFAULT]/notification_driver
#driver =
-{% if server.notification %}
+{%- if server.notification is mapping %}
+driver = {{ server.notification.get('driver', 'messagingv2') }}
+{%- if server.notification.topics is defined %}
+topics = {{ server.notification.topics }}
+{%- endif %}
+{%- elif server.notification %}
driver = messagingv2
-{% endif %}
+{%- endif %}
# A URL representing the messaging driver to use for notifications. If
# not set, we fall back to the same configuration used for RPC.
diff --git a/glance/files/mitaka/glance-registry.conf.Debian b/glance/files/mitaka/glance-registry.conf.Debian
index 08cbd82..83fe12f 100644
--- a/glance/files/mitaka/glance-registry.conf.Debian
+++ b/glance/files/mitaka/glance-registry.conf.Debian
@@ -1125,9 +1125,14 @@
# messaging, messagingv2, routing, log, test, noop (multi valued)
# Deprecated group/name - [DEFAULT]/notification_driver
#driver =
-{% if server.notification %}
+{%- if server.notification is mapping %}
+driver = {{ server.notification.get('driver', 'messagingv2') }}
+{%- if server.notification.topics is defined %}
+topics = {{ server.notification.topics }}
+{%- endif %}
+{%- elif server.notification %}
driver = messagingv2
-{% endif %}
+{%- endif %}
# A URL representing the messaging driver to use for notifications. If
# not set, we fall back to the same configuration used for RPC.