diff --git a/manifests/api.pp b/manifests/api.pp index dbf1056a..576248f4 100644 --- a/manifests/api.pp +++ b/manifests/api.pp @@ -30,10 +30,83 @@ # (optional) Maximum request size against the barbican API. # Defaults to $facts['os_service_default'] # +# [*enabled_secretstore_plugins*] +# (optional) Enabled secretstore plugins. Multiple plugins +# are defined in a list eg. ['store_crypto', dogtag_crypto'] +# Used when multiple_secret_stores_enabled is not set to true. +# Defaults to $facts['os_service_default'] +# +# [*enabled_crypto_plugins*] +# (optional) Enabled crypto_plugins. Multiple plugins +# are defined in a list eg. ['simple_crypto','p11_crypto'] +# Used when multiple_secret_stores_enabled is not set to true. +# Defaults to $facts['os_service_default'] +# +# [*enabled_secret_stores*] +# (optional) Enabled secretstores. This is the configuration +# parameters when multiple plugin configuration is used. +# Suffixes are defined in a comma separated list eg. +# 'simple_crypto,dogtag,kmip,pkcs11' +# Defaults to 'simple_crypto' +# +# [*multiple_secret_stores_enabled*] +# (optional) Enabled crypto_plugins. Multiple plugins +# are defined in a list eg. ['simple_crypto','p11_crypto'] +# Defaults to false +# +# [*auth_strategy*] +# (optional) authentication type +# Defaults to 'keystone' +# +# [*manage_service*] +# (optional) If Puppet should manage service startup / shutdown. +# Defaults to true. +# +# [*enabled*] +# (optional) Whether to enable services. +# Defaults to true. +# +# [*sync_db*] +# (optional) Run barbican-db-manage on api nodes. +# Defaults to true +# +# [*db_auto_create*] +# (optional) Barbican API server option to create the database +# automatically when the server starts. +# Defaults to $facts['os_service_default'] +# +# [*service_name*] +# (optional) Name of the service that will be providing the +# server functionality of barbican-api. +# If the value is 'httpd', this means barbican-api will be a web +# service, and you must use another class to configure that +# web service. For example, use class { 'barbican::wsgi::apache'...} +# to make barbican-api be a web app using apache mod_wsgi. +# Defaults to $::barbican::params::api_service_name +# +# [*enable_proxy_headers_parsing*] +# (Optional) Enable paste middleware to handle SSL requests through +# HTTPProxyToWSGI middleware. +# Defaults to $facts['os_service_default']. +# +# [*max_request_body_size*] +# (Optional) Set max request body size +# Defaults to $facts['os_service_default']. +# +# [*max_limit_paging*] +# (Optional) Maximum page size for the 'limit' paging URL parameter. +# Defaults to $facts['os_service_default'] +# +# [*default_limit_paging*] +# (Optional) Default page size for the 'limit' paging URL parameter. +# Defaults to $facts['os_service_default'] +# +# DEPRECATED PARAMETERS +# # [*default_transport_url*] # (optional) Connection url for oslo messaging backend. An example rabbit url # would be, rabbit://user:pass@host:port/virtual_host -# Defaults to $facts['os_service_default'] +# Defaults to undef # # [*rpc_response_timeout*] # (Optional) Seconds to wait for a response from a call. @@ -151,30 +224,6 @@ # (optional) Server name for RPC service # Defaults to $facts['os_service_default'] # -# [*enabled_secretstore_plugins*] -# (optional) Enabled secretstore plugins. Multiple plugins -# are defined in a list eg. ['store_crypto', dogtag_crypto'] -# Used when multiple_secret_stores_enabled is not set to true. -# Defaults to $facts['os_service_default'] -# -# [*enabled_crypto_plugins*] -# (optional) Enabled crypto_plugins. Multiple plugins -# are defined in a list eg. ['simple_crypto','p11_crypto'] -# Used when multiple_secret_stores_enabled is not set to true. -# Defaults to $facts['os_service_default'] -# -# [*enabled_secret_stores*] -# (optional) Enabled secretstores. This is the configuration -# parameters when multiple plugin configuration is used. -# Suffixes are defined in a comma separated list eg. -# 'simple_crypto,dogtag,kmip,pkcs11' -# Defaults to 'simple_crypto' -# -# [*multiple_secret_stores_enabled*] -# (optional) Enabled crypto_plugins. Multiple plugins -# are defined in a list eg. ['simple_crypto','p11_crypto'] -# Defaults to false -# # [*kombu_ssl_ca_certs*] # (optional) SSL certification authority file (valid only if SSL enabled). # Defaults to $facts['os_service_default'] @@ -210,53 +259,6 @@ # (string value) # Defaults to $facts['os_service_default'] # -# [*auth_strategy*] -# (optional) authentication type -# Defaults to 'keystone' -# -# [*manage_service*] -# (optional) If Puppet should manage service startup / shutdown. -# Defaults to true. -# -# [*enabled*] -# (optional) Whether to enable services. -# Defaults to true. -# -# [*sync_db*] -# (optional) Run barbican-db-manage on api nodes. -# Defaults to true -# -# [*db_auto_create*] -# (optional) Barbican API server option to create the database -# automatically when the server starts. -# Defaults to $facts['os_service_default'] -# -# [*service_name*] -# (optional) Name of the service that will be providing the -# server functionality of barbican-api. -# If the value is 'httpd', this means barbican-api will be a web -# service, and you must use another class to configure that -# web service. For example, use class { 'barbican::wsgi::apache'...} -# to make barbican-api be a web app using apache mod_wsgi. -# Defaults to $::barbican::params::api_service_name -# -# [*enable_proxy_headers_parsing*] -# (Optional) Enable paste middleware to handle SSL requests through -# HTTPProxyToWSGI middleware. -# Defaults to $facts['os_service_default']. -# -# [*max_request_body_size*] -# (Optional) Set max request body size -# Defaults to $facts['os_service_default']. -# -# [*max_limit_paging*] -# (Optional) Maximum page size for the 'limit' paging URL parameter. -# Defaults to $facts['os_service_default'] -# -# [*default_limit_paging*] -# (Optional) Default page size for the 'limit' paging URL parameter. -# Defaults to $facts['os_service_default'] -# class barbican::api ( $package_ensure = 'present', $bind_host = '0.0.0.0', @@ -264,7 +266,22 @@ class barbican::api ( $host_href = undef, $max_allowed_secret_in_bytes = $facts['os_service_default'], $max_allowed_request_size_in_bytes = $facts['os_service_default'], - $default_transport_url = $facts['os_service_default'], + $enabled_secretstore_plugins = $facts['os_service_default'], + $enabled_crypto_plugins = $facts['os_service_default'], + $enabled_secret_stores = 'simple_crypto', + Boolean $multiple_secret_stores_enabled = false, + $auth_strategy = 'keystone', + Boolean $manage_service = true, + Boolean $enabled = true, + Boolean $sync_db = true, + $db_auto_create = $facts['os_service_default'], + $service_name = $::barbican::params::api_service_name, + $enable_proxy_headers_parsing = $facts['os_service_default'], + $max_request_body_size = $facts['os_service_default'], + $max_limit_paging = $facts['os_service_default'], + $default_limit_paging = $facts['os_service_default'], + # DEPRECATED PARAMETERS + $default_transport_url = undef, $rpc_response_timeout = $facts['os_service_default'], $control_exchange = $facts['os_service_default'], $notification_transport_url = $facts['os_service_default'], @@ -289,10 +306,6 @@ class barbican::api ( $queue_topic = $facts['os_service_default'], $queue_version = $facts['os_service_default'], $queue_server_name = $facts['os_service_default'], - $enabled_secretstore_plugins = $facts['os_service_default'], - $enabled_crypto_plugins = $facts['os_service_default'], - $enabled_secret_stores = 'simple_crypto', - Boolean $multiple_secret_stores_enabled = false, $kombu_ssl_ca_certs = $facts['os_service_default'], $kombu_ssl_certfile = $facts['os_service_default'], $kombu_ssl_keyfile = $facts['os_service_default'], @@ -300,16 +313,6 @@ class barbican::api ( $kombu_reconnect_delay = $facts['os_service_default'], $kombu_failover_strategy = $facts['os_service_default'], $kombu_compression = $facts['os_service_default'], - $auth_strategy = 'keystone', - Boolean $manage_service = true, - Boolean $enabled = true, - Boolean $sync_db = true, - $db_auto_create = $facts['os_service_default'], - $service_name = $::barbican::params::api_service_name, - $enable_proxy_headers_parsing = $facts['os_service_default'], - $max_request_body_size = $facts['os_service_default'], - $max_limit_paging = $facts['os_service_default'], - $default_limit_paging = $facts['os_service_default'], ) inherits barbican::params { include barbican::deps @@ -334,49 +337,55 @@ class barbican::api ( 'DEFAULT/host_href': value => $host_href_real; } - oslo::messaging::rabbit {'barbican_config': - rabbit_use_ssl => $rabbit_use_ssl, - heartbeat_timeout_threshold => $rabbit_heartbeat_timeout_threshold, - heartbeat_rate => $rabbit_heartbeat_rate, - heartbeat_in_pthread => $rabbit_heartbeat_in_pthread, - rabbit_qos_prefetch_count => $rabbit_qos_prefetch_count, - kombu_reconnect_delay => $kombu_reconnect_delay, - kombu_failover_strategy => $kombu_failover_strategy, - amqp_durable_queues => $amqp_durable_queues, - kombu_compression => $kombu_compression, - kombu_ssl_ca_certs => $kombu_ssl_ca_certs, - kombu_ssl_certfile => $kombu_ssl_certfile, - kombu_ssl_keyfile => $kombu_ssl_keyfile, - kombu_ssl_version => $kombu_ssl_version, - rabbit_ha_queues => $rabbit_ha_queues, - rabbit_quorum_queue => $rabbit_quorum_queue, - rabbit_transient_quorum_queue => $rabbit_transient_quorum_queue, - 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, - enable_cancel_on_failover => $rabbit_enable_cancel_on_failover, - } + include barbican + if $::barbican::default_transport_url == undef or $default_transport_url { + warning("The queue parameters and oslo.messaging parameters have been deprecated. \ +Use the parameters of the barbican class.") - oslo::messaging::default { 'barbican_config': - transport_url => $default_transport_url, - rpc_response_timeout => $rpc_response_timeout, - control_exchange => $control_exchange, - } + oslo::messaging::rabbit {'barbican_config': + rabbit_use_ssl => $rabbit_use_ssl, + heartbeat_timeout_threshold => $rabbit_heartbeat_timeout_threshold, + heartbeat_rate => $rabbit_heartbeat_rate, + heartbeat_in_pthread => $rabbit_heartbeat_in_pthread, + rabbit_qos_prefetch_count => $rabbit_qos_prefetch_count, + kombu_reconnect_delay => $kombu_reconnect_delay, + kombu_failover_strategy => $kombu_failover_strategy, + amqp_durable_queues => $amqp_durable_queues, + kombu_compression => $kombu_compression, + kombu_ssl_ca_certs => $kombu_ssl_ca_certs, + kombu_ssl_certfile => $kombu_ssl_certfile, + kombu_ssl_keyfile => $kombu_ssl_keyfile, + kombu_ssl_version => $kombu_ssl_version, + rabbit_ha_queues => $rabbit_ha_queues, + rabbit_quorum_queue => $rabbit_quorum_queue, + rabbit_transient_quorum_queue => $rabbit_transient_quorum_queue, + 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, + enable_cancel_on_failover => $rabbit_enable_cancel_on_failover, + } - oslo::messaging::notifications { 'barbican_config': - driver => $notification_driver, - transport_url => $notification_transport_url, - topics => $notification_topics, - retry => $notification_retry, - } + oslo::messaging::default { 'barbican_config': + transport_url => pick($default_transport_url, $facts['os_service_default']), + rpc_response_timeout => $rpc_response_timeout, + control_exchange => $control_exchange, + } - # queue options - barbican_config { - 'queue/enable': value => $enable_queue; - 'queue/namespace': value => $queue_namespace; - 'queue/topic': value => $queue_topic; - 'queue/version': value => $queue_version; - 'queue/server_name': value => $queue_server_name; + oslo::messaging::notifications { 'barbican_config': + driver => $notification_driver, + transport_url => $notification_transport_url, + topics => $notification_topics, + retry => $notification_retry, + } + + # queue options + barbican_config { + 'queue/enable': value => $enable_queue; + 'queue/namespace': value => $queue_namespace; + 'queue/topic': value => $queue_topic; + 'queue/version': value => $queue_version; + 'queue/server_name': value => $queue_server_name; + } } # max allowed secret options diff --git a/manifests/init.pp b/manifests/init.pp index a61a6d0d..1bf34efb 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -8,13 +8,201 @@ # (Optional) Ensure state for package. # Defaults to 'present'. # +# [*default_transport_url*] +# (optional) Connection url for oslo messaging backend. An example rabbit url +# would be, rabbit://user:pass@host:port/virtual_host +# Defaults to undef +# +# [*rpc_response_timeout*] +# (Optional) Seconds to wait for a response from a call. +# Defaults to $facts['os_service_default'] +# +# [*control_exchange*] +# (Optional) The default exchange under which topics are scoped. May be +# overridden by an exchange name specified in the transport_url +# option. +# Defaults to $facts['os_service_default'] +# +# [*notification_transport_url*] +# (optional) Connection url for oslo messaging notifications backend. An +# example rabbit url would be, rabbit://user:pass@host:port/virtual_host +# Defaults to $facts['os_service_default'] +# +# [*notification_driver*] +# (optional) Driver to use for oslo messaging notifications backend. +# Defaults to $facts['os_service_default'] +# +# [*notification_topics*] +# (optional) Topics to use for oslo messaging notifications backend. +# Defaults to $facts['os_service_default'] +# +# [*notification_retry*] +# (optional) The maximum number of attempts to re-sent a notification +# message, which failed to be delivered due to a recoverable error. +# Defaults to $facts['os_service_default']. +# +# [*rabbit_use_ssl*] +# (optional) Connect over SSL for RabbitMQ +# Defaults to $facts['os_service_default'] +# +# [*rabbit_ha_queues*] +# (optional) Use HA queues in RabbitMQ. +# Defaults to $facts['os_service_default'] +# +# [*rabbit_quorum_queue*] +# (Optional) Use quorum queues in RabbitMQ. +# Defaults to $facts['os_service_default'] +# +# [*rabbit_transient_quorum_queue*] +# (Optional) Use quorum queues for transients queues in RabbitMQ. +# 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 +# the message gets dropped or dead-lettered. +# Defaults to $facts['os_service_default'] +# +# [*rabbit_quorum_max_memory_length*] +# (Optional) Limit the number of messages in the quorum queue. +# Defaults to $facts['os_service_default'] +# +# [*rabbit_quorum_max_memory_bytes*] +# (Optional) Limit the number of memory bytes used by the quorum queue. +# Defaults to $facts['os_service_default'] +# +# [*rabbit_enable_cancel_on_failover*] +# (Optional) Enable x-cancel-on-ha-failover flag so that rabbitmq server will +# cancel and notify consumers when queue is down. +# Defaults to $facts['os_service_default'] +# +# [*rabbit_heartbeat_timeout_threshold*] +# (optional) Number of seconds after which the RabbitMQ broker is considered +# down if the heartbeat keepalive fails. Any value >0 enables heartbeats. +# Heartbeating helps to ensure the TCP connection to RabbitMQ isn't silently +# closed, resulting in missed or lost messages from the queue. +# (Requires kombu >= 3.0.7 and amqp >= 1.4.0) +# Defaults to $facts['os_service_default'] +# +# [*rabbit_heartbeat_rate*] +# (optional) How often during the rabbit_heartbeat_timeout_threshold period to +# check the heartbeat on RabbitMQ connection. (i.e. rabbit_heartbeat_rate=2 +# when rabbit_heartbeat_timeout_threshold=60, the heartbeat will be checked +# every 30 seconds. +# Defaults to $facts['os_service_default'] +# +# [*rabbit_heartbeat_in_pthread*] +# (Optional) EXPERIMENTAL: Run the health check heartbeat thread +# through a native python thread. By default if this +# option isn't provided the health check heartbeat will +# inherit the execution model from the parent process. By +# example if the parent process have monkey patched the +# stdlib by using eventlet/greenlet then the heartbeat +# will be run through a green thread. +# Defaults to $facts['os_service_default'] +# +# [*rabbit_qos_prefetch_count*] +# (Optional) Specifies the number of messages to prefetch. +# Defaults to $facts['os_service_default'] +# +# [*amqp_durable_queues*] +# (optional) Define queues as "durable" to rabbitmq. +# Defaults to $facts['os_service_default'] +# +# [*queue_enable*] +# (optional) Enable asynchronous queuing +# Defaults to $facts['os_service_default'] +# +# [*queue_namespace*] +# (optional) Namespace for the queue +# Defaults to $facts['os_service_default'] +# +# [*queue_topic*] +# (optional) Topic for the queue +# Defaults to $facts['os_service_default'] +# +# [*queue_version*] +# (optional) Version for the task API +# Defaults to $facts['os_service_default'] +# +# [*queue_server_name*] +# (optional) Server name for RPC service +# Defaults to $facts['os_service_default'] +# +# [*kombu_ssl_ca_certs*] +# (optional) SSL certification authority file (valid only if SSL enabled). +# Defaults to $facts['os_service_default'] +# +# [*kombu_ssl_certfile*] +# (optional) SSL cert file (valid only if SSL enabled). +# Defaults to $facts['os_service_default'] +# +# [*kombu_ssl_keyfile*] +# (optional) SSL key file (valid only if SSL enabled). +# Defaults to $facts['os_service_default'] +# +# [*kombu_ssl_version*] +# (optional) SSL version to use (valid only if SSL enabled). +# Valid values are TLSv1, SSLv23 and SSLv3. SSLv2 may be +# available on some distributions. +# Defaults to $facts['os_service_default'] +# +# [*kombu_reconnect_delay*] +# (optional) How long to wait before reconnecting in response to an AMQP +# consumer cancel notification. +# Defaults to $facts['os_service_default'] +# +# [*kombu_failover_strategy*] +# (Optional) Determines how the next RabbitMQ node is chosen in case the one +# we are currently connected to becomes unavailable. Takes effect only if +# more than one RabbitMQ node is provided in config. (string value) +# Defaults to $facts['os_service_default'] +# +# [*kombu_compression*] +# (optional) Possible values are: gzip, bz2. If not set compression will not +# be used. This option may notbe available in future versions. EXPERIMENTAL. +# (string value) +# Defaults to $facts['os_service_default'] +# # [*purge_config*] # (optional) Whether to set only the specified config options # in the cinder config. # Defaults to false. # class barbican( - $package_ensure = 'present', + $package_ensure = 'present', + $default_transport_url = undef, + $rpc_response_timeout = $facts['os_service_default'], + $control_exchange = $facts['os_service_default'], + $notification_transport_url = $facts['os_service_default'], + $notification_driver = $facts['os_service_default'], + $notification_topics = $facts['os_service_default'], + $notification_retry = $facts['os_service_default'], + $rabbit_use_ssl = $facts['os_service_default'], + $rabbit_heartbeat_timeout_threshold = $facts['os_service_default'], + $rabbit_heartbeat_rate = $facts['os_service_default'], + $rabbit_heartbeat_in_pthread = $facts['os_service_default'], + $rabbit_qos_prefetch_count = $facts['os_service_default'], + $rabbit_ha_queues = $facts['os_service_default'], + $rabbit_quorum_queue = $facts['os_service_default'], + $rabbit_transient_quorum_queue = $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'], + $rabbit_enable_cancel_on_failover = $facts['os_service_default'], + $amqp_durable_queues = $facts['os_service_default'], + $queue_enable = $facts['os_service_default'], + $queue_namespace = $facts['os_service_default'], + $queue_topic = $facts['os_service_default'], + $queue_version = $facts['os_service_default'], + $queue_server_name = $facts['os_service_default'], + $kombu_ssl_ca_certs = $facts['os_service_default'], + $kombu_ssl_certfile = $facts['os_service_default'], + $kombu_ssl_keyfile = $facts['os_service_default'], + $kombu_ssl_version = $facts['os_service_default'], + $kombu_reconnect_delay = $facts['os_service_default'], + $kombu_failover_strategy = $facts['os_service_default'], + $kombu_compression = $facts['os_service_default'], Boolean $purge_config = false, ) { @@ -30,4 +218,51 @@ class barbican( resources { 'barbican_config': purge => $purge_config, } + + if $default_transport_url { + oslo::messaging::rabbit {'barbican_config': + rabbit_use_ssl => $rabbit_use_ssl, + heartbeat_timeout_threshold => $rabbit_heartbeat_timeout_threshold, + heartbeat_rate => $rabbit_heartbeat_rate, + heartbeat_in_pthread => $rabbit_heartbeat_in_pthread, + rabbit_qos_prefetch_count => $rabbit_qos_prefetch_count, + kombu_reconnect_delay => $kombu_reconnect_delay, + kombu_failover_strategy => $kombu_failover_strategy, + amqp_durable_queues => $amqp_durable_queues, + kombu_compression => $kombu_compression, + kombu_ssl_ca_certs => $kombu_ssl_ca_certs, + kombu_ssl_certfile => $kombu_ssl_certfile, + kombu_ssl_keyfile => $kombu_ssl_keyfile, + kombu_ssl_version => $kombu_ssl_version, + rabbit_ha_queues => $rabbit_ha_queues, + rabbit_quorum_queue => $rabbit_quorum_queue, + rabbit_transient_quorum_queue => $rabbit_transient_quorum_queue, + 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, + enable_cancel_on_failover => $rabbit_enable_cancel_on_failover, + } + + oslo::messaging::default { 'barbican_config': + transport_url => $default_transport_url, + rpc_response_timeout => $rpc_response_timeout, + control_exchange => $control_exchange, + } + + oslo::messaging::notifications { 'barbican_config': + driver => $notification_driver, + transport_url => $notification_transport_url, + topics => $notification_topics, + retry => $notification_retry, + } + + # queue options + barbican_config { + 'queue/enable': value => $queue_enable; + 'queue/namespace': value => $queue_namespace; + 'queue/topic': value => $queue_topic; + 'queue/version': value => $queue_version; + 'queue/server_name': value => $queue_server_name; + } + } } diff --git a/releasenotes/notes/migrate-queue-options-0a67db57467fcd94.yaml b/releasenotes/notes/migrate-queue-options-0a67db57467fcd94.yaml new file mode 100644 index 00000000..f2d47746 --- /dev/null +++ b/releasenotes/notes/migrate-queue-options-0a67db57467fcd94.yaml @@ -0,0 +1,6 @@ +--- +deprecations: + - | + Support for the oslo.messaging options and queue options by + the ``barbican::api`` class. Use the parameters of the ``barbican`` class + instead. diff --git a/spec/classes/barbican_init_spec.rb b/spec/classes/barbican_init_spec.rb index 6a905594..d07bdc5f 100644 --- a/spec/classes/barbican_init_spec.rb +++ b/spec/classes/barbican_init_spec.rb @@ -25,6 +25,141 @@ describe 'barbican' do }) end end + + context 'with transport_url' do + let :params do + { + :default_transport_url => 'rabbit://bugs:bugs_bunny@localhost:1234/rabbithost', + } + end + + it 'configures queue_options' do + is_expected.to contain_barbican_config('queue/enable').with_value('') + is_expected.to contain_barbican_config('queue/namespace').with_value('') + is_expected.to contain_barbican_config('queue/topic').with_value('') + is_expected.to contain_barbican_config('queue/version').with_value('') + is_expected.to contain_barbican_config('queue/server_name').with_value('') + end + + it 'configures rabbitmq parameters' do + is_expected.to contain_oslo__messaging__default('barbican_config').with( + :transport_url => 'rabbit://bugs:bugs_bunny@localhost:1234/rabbithost', + :rpc_response_timeout => '', + :control_exchange => '', + ) + is_expected.to contain_oslo__messaging__notifications('barbican_config').with( + :transport_url => '', + :driver => '', + :topics => '', + :retry => '', + ) + is_expected.to contain_oslo__messaging__rabbit('barbican_config').with( + :rabbit_use_ssl => '', + :heartbeat_timeout_threshold => '', + :heartbeat_rate => '', + :heartbeat_in_pthread => '', + :rabbit_qos_prefetch_count => '', + :kombu_reconnect_delay => '', + :kombu_failover_strategy => '', + :amqp_durable_queues => '', + :kombu_compression => '', + :kombu_ssl_ca_certs => '', + :kombu_ssl_certfile => '', + :kombu_ssl_keyfile => '', + :kombu_ssl_version => '', + :rabbit_ha_queues => '', + :rabbit_quorum_queue => '', + :rabbit_transient_quorum_queue => '', + :rabbit_quorum_delivery_limit => '', + :rabbit_quorum_max_memory_length => '', + :rabbit_quorum_max_memory_bytes => '', + :enable_cancel_on_failover => '', + ) + end + end + + context 'with parameters' do + let :params do + { + :default_transport_url => 'rabbit://bugs:bugs_bunny@localhost:1234/rabbithost', + :rpc_response_timeout => '120', + :control_exchange => 'barbican', + :notification_transport_url => 'rabbit://bugs:bugs_bunny@localhost:1234/rabbithost', + :notification_driver => 'kombu', + :notification_topics => 'notifications', + :notification_retry => 10, + :rabbit_use_ssl => true, + :rabbit_heartbeat_timeout_threshold => '10', + :rabbit_heartbeat_rate => '10', + :rabbit_heartbeat_in_pthread => true, + :rabbit_qos_prefetch_count => 0, + :rabbit_ha_queues => true, + :rabbit_quorum_queue => true, + :rabbit_transient_quorum_queue => true, + :rabbit_quorum_delivery_limit => 3, + :rabbit_quorum_max_memory_length => 5, + :rabbit_quorum_max_memory_bytes => 1073741824, + :rabbit_enable_cancel_on_failover => false, + :amqp_durable_queues => true, + :queue_enable => true, + :queue_namespace => 'barbican1', + :queue_topic => 'barbican1.workers', + :queue_version => '1.2', + :queue_server_name => 'barbican1.queue', + :kombu_ssl_ca_certs => 'path_to_certs', + :kombu_ssl_certfile => 'path_to_certfile', + :kombu_ssl_keyfile => 'path_to_keyfile', + :kombu_ssl_version => '1.2', + :kombu_reconnect_delay => '10', + :kombu_failover_strategy => 'shuffle', + :kombu_compression => 'gzip', + } + end + + it 'configures queue_options' do + is_expected.to contain_barbican_config('queue/enable').with_value(params[:queue_enable]) + is_expected.to contain_barbican_config('queue/namespace').with_value(params[:queue_namespace]) + is_expected.to contain_barbican_config('queue/topic').with_value(params[:queue_topic]) + is_expected.to contain_barbican_config('queue/version').with_value(params[:queue_version]) + is_expected.to contain_barbican_config('queue/server_name').with_value(params[:queue_server_name]) + end + + it 'configures rabbitmq parameters' do + is_expected.to contain_oslo__messaging__default('barbican_config').with( + :transport_url => params[:default_transport_url], + :rpc_response_timeout => params[:rpc_response_timeout], + :control_exchange => params[:control_exchange] + ) + is_expected.to contain_oslo__messaging__notifications('barbican_config').with( + :transport_url => params[:notification_transport_url], + :driver => params[:notification_driver], + :topics => params[:notification_topics], + :retry => params[:notification_retry], + ) + is_expected.to contain_oslo__messaging__rabbit('barbican_config').with( + :rabbit_use_ssl => params[:rabbit_use_ssl], + :heartbeat_timeout_threshold => params[:rabbit_heartbeat_timeout_threshold], + :heartbeat_rate => params[:rabbit_heartbeat_rate], + :heartbeat_in_pthread => params[:rabbit_heartbeat_in_pthread], + :rabbit_qos_prefetch_count => params[:rabbit_qos_prefetch_count], + :kombu_reconnect_delay => params[:kombu_reconnect_delay], + :kombu_failover_strategy => params[:kombu_failover_strategy], + :amqp_durable_queues => params[:amqp_durable_queues], + :kombu_compression => params[:kombu_compression], + :kombu_ssl_ca_certs => params[:kombu_ssl_ca_certs], + :kombu_ssl_certfile => params[:kombu_ssl_certfile], + :kombu_ssl_keyfile => params[:kombu_ssl_keyfile], + :kombu_ssl_version => params[:kombu_ssl_version], + :rabbit_ha_queues => params[:rabbit_ha_queues], + :rabbit_quorum_queue => params[:rabbit_quorum_queue], + :rabbit_transient_quorum_queue => params[:rabbit_transient_quorum_queue], + :rabbit_quorum_delivery_limit => params[:rabbit_quorum_delivery_limit], + :rabbit_quorum_max_memory_length => params[:rabbit_quorum_max_memory_length], + :rabbit_quorum_max_memory_bytes => params[:rabbit_quorum_max_memory_bytes], + :enable_cancel_on_failover => params[:rabbit_enable_cancel_on_failover], + ) + end + end end on_supported_os({