Author: Thomas Goirand <zigo@debian.org>
Date: Wed, 12 Mar 2025 16:46:11 +0100
Description: Add a rabbit_transient_queues_ttl and amqp_auto_delete params
 Note that this patch needs:
 https://review.opendev.org/c/openstack/puppet-oslo/+/944132
 so do not merge before it.
Change-Id: I5d02e065ca383e776da540f82afe9a9afd1781b5
Forwarded: https://review.opendev.org/c/openstack/puppet-heat/+/944127
Last-Update: 2025-03-12

Index: puppet-module-heat/manifests/init.pp
===================================================================
--- puppet-module-heat.orig/manifests/init.pp
+++ puppet-module-heat/manifests/init.pp
@@ -69,6 +69,14 @@
 #   (Optional) Use quorum queues for transients queues in RabbitMQ.
 #   Defaults to $facts['os_service_default']
 #
+# [*rabbit_transient_queues_ttl*]
+#   (Optional) Positive integer representing duration in seconds for
+#   queue TTL (x-expires). Queues which are unused for the duration
+#   of the TTL are automatically deleted.
+#   The parameter affects only reply and fanout queues. (integer value)
+#   Min to 1
+#   Defaults to $facts['os_service_default']
+#
 # [*rabbit_quorum_delivery_limit*]
 #   (Optional) Each time a message is rdelivered to a consumer, a counter is
 #   incremented. Once the redelivery count exceeds the delivery limit
@@ -127,6 +135,10 @@
 #   (string value)
 #   Defaults to $facts['os_service_default']
 #
+# [*amqp_auto_delete*]
+#   (Optional) Define if transient queues should be auto-deleted (boolean value)
+#   Defaults to $facts['os_service_default']
+#
 # [*amqp_durable_queues*]
 #   (Optional) Use durable queues in amqp.
 #   Defaults to $facts['os_service_default'].
@@ -234,6 +246,7 @@ class heat(
   $rabbit_qos_prefetch_count          = $facts['os_service_default'],
   $rabbit_quorum_queue                = $facts['os_service_default'],
   $rabbit_transient_quorum_queue      = $facts['os_service_default'],
+  $rabbit_transient_queues_ttl        = $facts['os_service_default'],
   $rabbit_quorum_delivery_limit       = $facts['os_service_default'],
   $rabbit_quorum_max_memory_length    = $facts['os_service_default'],
   $rabbit_quorum_max_memory_bytes     = $facts['os_service_default'],
@@ -247,6 +260,7 @@ class heat(
   $kombu_failover_strategy            = $facts['os_service_default'],
   $kombu_compression                  = $facts['os_service_default'],
   $amqp_durable_queues                = $facts['os_service_default'],
+  $amqp_auto_delete                   = $facts['os_service_default'],
   $host                               = $facts['os_service_default'],
   $flavor                             = $facts['os_service_default'],
   $region_name                        = $facts['os_service_default'],
@@ -299,9 +313,11 @@ class heat(
     rabbit_qos_prefetch_count       => $rabbit_qos_prefetch_count,
     rabbit_use_ssl                  => $rabbit_use_ssl,
     amqp_durable_queues             => $amqp_durable_queues,
+    amqp_auto_delete                => $amqp_auto_delete,
     rabbit_ha_queues                => $rabbit_ha_queues,
     rabbit_quorum_queue             => $rabbit_quorum_queue,
     rabbit_transient_quorum_queue   => $rabbit_transient_quorum_queue,
+    rabbit_transient_queues_ttl     => $rabbit_transient_queues_ttl,
     rabbit_quorum_delivery_limit    => $rabbit_quorum_delivery_limit,
     rabbit_quorum_max_memory_length => $rabbit_quorum_max_memory_length,
     rabbit_quorum_max_memory_bytes  => $rabbit_quorum_max_memory_bytes,
Index: puppet-module-heat/releasenotes/notes/amqp_auto_delete-098ad0ce851da23f.yaml
===================================================================
--- /dev/null
+++ puppet-module-heat/releasenotes/notes/amqp_auto_delete-098ad0ce851da23f.yaml
@@ -0,0 +1,5 @@
+---
+features:
+  - |
+    Add a new `amqp_auto_delete` parameter, so that transient queues are
+    automatically deleted.
Index: puppet-module-heat/releasenotes/notes/transient_queues_ttl-d93c0e84d9ebc86a.yaml
===================================================================
--- /dev/null
+++ puppet-module-heat/releasenotes/notes/transient_queues_ttl-d93c0e84d9ebc86a.yaml
@@ -0,0 +1,6 @@
+---
+features:
+  - |
+    A new parameter ``rabbit_transient_queues_ttl`` has been added to the
+    heat init class to configure how long transtient queue should stay until
+    they are automatically deleted.
Index: puppet-module-heat/spec/classes/heat_init_spec.rb
===================================================================
--- puppet-module-heat.orig/spec/classes/heat_init_spec.rb
+++ puppet-module-heat/spec/classes/heat_init_spec.rb
@@ -141,9 +141,11 @@ describe 'heat' do
         :rabbit_qos_prefetch_count       => '<SERVICE DEFAULT>',
         :rabbit_use_ssl                  => '<SERVICE DEFAULT>',
         :amqp_durable_queues             => '<SERVICE DEFAULT>',
+        :amqp_auto_delete                => '<SERVICE DEFAULT>',
         :rabbit_ha_queues                => '<SERVICE DEFAULT>',
         :rabbit_quorum_queue             => '<SERVICE DEFAULT>',
         :rabbit_transient_quorum_queue   => '<SERVICE DEFAULT>',
+        :rabbit_transient_queues_ttl     => '<SERVICE DEFAULT>',
         :rabbit_quorum_delivery_limit    => '<SERVICE DEFAULT>',
         :rabbit_quorum_max_memory_length => '<SERVICE DEFAULT>',
         :rabbit_quorum_max_memory_bytes  => '<SERVICE DEFAULT>',
@@ -176,6 +178,7 @@ describe 'heat' do
         :rabbit_ha_queues                => true,
         :rabbit_quorum_queue             => '<SERVICE DEFAULT>',
         :rabbit_transient_quorum_queue   => '<SERVICE DEFAULT>',
+        :rabbit_transient_queues_ttl     => '<SERVICE DEFAULT>',
         :rabbit_quorum_delivery_limit    => '<SERVICE DEFAULT>',
         :rabbit_quorum_max_memory_length => '<SERVICE DEFAULT>',
         :rabbit_quorum_max_memory_bytes  => '<SERVICE DEFAULT>',
