From 74c76bdadbcc7f48ba754aab4beec7955f32ebaa Mon Sep 17 00:00:00 2001 From: Ade Lee Date: Tue, 22 Mar 2016 12:50:03 -0400 Subject: [PATCH] Add keystone notification options to barbican-api manifest Change-Id: Ifc3f016611268f3dc7d9e39428b423852536982d --- manifests/keystone/notification.pp | 42 ++++++++++++++ spec/acceptance/basic_barbican_spec.rb | 3 + .../barbican_keystone_notification_spec.rb | 58 +++++++++++++++++++ 3 files changed, 103 insertions(+) create mode 100644 manifests/keystone/notification.pp create mode 100644 spec/classes/barbican_keystone_notification_spec.rb diff --git a/manifests/keystone/notification.pp b/manifests/keystone/notification.pp new file mode 100644 index 00000000..dc7b13ea --- /dev/null +++ b/manifests/keystone/notification.pp @@ -0,0 +1,42 @@ +# == Class: barbican::keystone::notification +# +# Sets up keystone notifications for the Barbican API server +# +# === Parameters +# +# [*enable_keystone_notification*] +# (optional) Enable keystone notification listener functionality +# Defaults to $::os_service_default +# +# [*keystone_notification_control_exchange*] +# (optional) The default exchange under which topics are scoped. +# Defaults to $::os_service_default +# +# [*keystone_notification_topic*] +# (optional) Keystone notification queue topic name. +# Defaults to $::os_service_default +# +# [*keystone_notification_allow_requeue*] +# (optional) Requeues notification in case of notification processing error. +# Defaults to $::os_service_default +# +# [*keystone_notification_thread_pool_size*] +# (optional) max threads to be used for notification server +# Defaults to $::os_service_default +# +class barbican::keystone::notification ( + $enable_keystone_notification = $::os_service_default, + $keystone_notification_control_exchange = $::os_service_default, + $keystone_notification_topic = $::os_service_default, + $keystone_notification_allow_requeue = $::os_service_default, + $keystone_notification_thread_pool_size = $::os_service_default, +) { + + barbican_config { + 'keystone_notifications/enable': value => $enable_keystone_notification; + 'keystone_notifications/control_exchange': value => $keystone_notification_control_exchange; + 'keystone_notifications/topic': value => $keystone_notification_topic; + 'keystone_notifications/allow_requeue': value => $keystone_notification_allow_requeue; + 'keystone_notifications/thread_pool_size': value => $keystone_notification_thread_pool_size; + } +} diff --git a/spec/acceptance/basic_barbican_spec.rb b/spec/acceptance/basic_barbican_spec.rb index 515be436..ddde7324 100644 --- a/spec/acceptance/basic_barbican_spec.rb +++ b/spec/acceptance/basic_barbican_spec.rb @@ -21,6 +21,9 @@ describe 'barbican::api class' do class { '::barbican::quota': } + class { '::barbican::keystone::notification': + } + class { '::barbican::api': } } diff --git a/spec/classes/barbican_keystone_notification_spec.rb b/spec/classes/barbican_keystone_notification_spec.rb new file mode 100644 index 00000000..5c9cf6fc --- /dev/null +++ b/spec/classes/barbican_keystone_notification_spec.rb @@ -0,0 +1,58 @@ +require 'spec_helper' + +describe 'barbican::keystone::notification' do + + let :facts do + @default_facts.merge( + { + :osfamily => 'RedHat', + :processorcount => '7', + } + ) + end + + let :default_params do + { + :enable_keystone_notification => '', + :keystone_notification_control_exchange => '', + :keystone_notification_topic => '', + :keystone_notification_allow_requeue => '', + :keystone_notification_thread_pool_size => '', + } + end + + [{}, + { + :enable_keystone_notification => true, + :keystone_notification_control_exchange => 'exchange_data', + :keystone_notification_topic => 'barbican', + :keystone_notification_allow_requeue => true, + :keystone_notification_thread_pool_size => 20, + } + ].each do |param_set| + + describe "when #{param_set == {} ? "using default" : "specifying"} class parameters" do + + let :param_hash do + default_params.merge(param_set) + end + + let :params do + param_set + end + + it 'is_expected.to set keystone notification parameters' do + is_expected.to contain_barbican_config('keystone_notifications/enable')\ + .with_value(param_hash[:enable_keystone_notification]) + is_expected.to contain_barbican_config('keystone_notifications/allow_requeue')\ + .with_value(param_hash[:keystone_notification_allow_requeue]) + is_expected.to contain_barbican_config('keystone_notifications/thread_pool_size')\ + .with_value(param_hash[:keystone_notification_thread_pool_size]) + is_expected.to contain_barbican_config('keystone_notifications/topic')\ + .with_value(param_hash[:keystone_notification_topic]) + is_expected.to contain_barbican_config('keystone_notifications/control_exchange')\ + .with_value(param_hash[:keystone_notification_control_exchange]) + end + end + end +end