Add keystone notification options to barbican-api manifest

Change-Id: Ifc3f016611268f3dc7d9e39428b423852536982d
This commit is contained in:
Ade Lee 2016-03-22 12:50:03 -04:00
parent 00abb7c54d
commit 74c76bdadb
3 changed files with 103 additions and 0 deletions

View File

@ -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;
}
}

View File

@ -21,6 +21,9 @@ describe 'barbican::api class' do
class { '::barbican::quota':
}
class { '::barbican::keystone::notification':
}
class { '::barbican::api':
}
}

View File

@ -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 => '<SERVICE DEFAULT>',
:keystone_notification_control_exchange => '<SERVICE DEFAULT>',
:keystone_notification_topic => '<SERVICE DEFAULT>',
:keystone_notification_allow_requeue => '<SERVICE DEFAULT>',
:keystone_notification_thread_pool_size => '<SERVICE DEFAULT>',
}
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