Introduce support for oslo.messaging amqp driver configuration

This commit adds support for the olso.messaging AMQP 1.0 driver to
support notifications.

This patch:
* use oslo::messaging::amqp resource
* add keystone::messaging::amqp class for oslo_messaging_amqp opts
* add spec tests for amqp class options
* add feature release note

Change-Id: I4b56417ce8ee7502ad32da578bdc29c46e459bd5
This commit is contained in:
Andrew Smith 2017-02-28 13:28:29 -05:00
parent b0ee2426c2
commit f311e30730
3 changed files with 133 additions and 0 deletions

View File

@ -0,0 +1,63 @@
# Class keystone::messaging::amqp
#
# keystone messaging configuration
#
# == Parameters
#
# [*amqp_pre_settled*]
# (Optional) Send messages of this type pre-settled
# Defaults to $::os_service_default.
#
# [*amqp_idle_timeout*]
# (Optional) Timeout for inactive connections
# Defaults to $::os_service_default.
#
# [*amqp_ssl_ca_file*]
# (Optional) CA certificate PEM file to verify server certificate
# Defaults to $::os_service_default.
#
# [*amqp_ssl_cert_file*]
# (Optional) Identifying certificate PEM file to present to clients
# Defaults to $::os_service_default.
#
# [*amqp_ssl_key_file*]
# (Optional) Private key PEM file used to sign cert_file certificate
# Defaults to $::os_service_default.
#
# [*amqp_ssl_key_password*]
# (Optional) Password for decrypting ssl_key_file (if encrypted)
# Defaults to $::os_service_default.
#
# [*amqp_allow_insecure_clients*]
# (Optional) Accept clients using either SSL or plain TCP
# Defaults to $::os_service_default.
#
# [*amqp_sasl_mechanisms*]
# (Optional) Space separated list of acceptable SASL mechanisms
# Defaults to $::os_service_default.
#
class keystone::messaging::amqp(
$amqp_pre_settled = $::os_service_default,
$amqp_idle_timeout = $::os_service_default,
$amqp_ssl_ca_file = $::os_service_default,
$amqp_ssl_cert_file = $::os_service_default,
$amqp_ssl_key_file = $::os_service_default,
$amqp_ssl_key_password = $::os_service_default,
$amqp_allow_insecure_clients = $::os_service_default,
$amqp_sasl_mechanisms = $::os_service_default,
) {
include ::keystone::deps
oslo::messaging::amqp { 'keystone_config':
pre_settled => $amqp_pre_settled,
idle_timeout => $amqp_idle_timeout,
ssl_ca_file => $amqp_ssl_ca_file,
ssl_cert_file => $amqp_ssl_cert_file,
ssl_key_file => $amqp_ssl_key_file,
ssl_key_password => $amqp_ssl_key_password,
allow_insecure_clients => $amqp_allow_insecure_clients,
sasl_mechanisms => $amqp_sasl_mechanisms,
}
}

View File

@ -0,0 +1,3 @@
---
features:
- Add support for oslo_messaging_amqp 1.0 backend via puppet-oslo resource

View File

@ -0,0 +1,67 @@
require 'spec_helper'
describe 'keystone::messaging::amqp' do
shared_examples_for 'keystone messaging amqp' do
it { is_expected.to contain_class('keystone::messaging::amqp').with(
'amqp_pre_settled' => ['<SERVICE DEFAULT>'],
'amqp_idle_timeout' => '<SERVICE DEFAULT>',
'amqp_ssl_ca_file' => '<SERVICE DEFAULT>',
'amqp_ssl_cert_file' => '<SERVICE DEFAULT>',
'amqp_ssl_key_file' => '<SERVICE DEFAULT>',
'amqp_ssl_key_password' => '<SERVICE DEFAULT>',
'amqp_allow_insecure_clients' => '<SERVICE DEFAULT>',
'amqp_sasl_mechanisms' => '<SERVICE DEFAULT>',
)}
context 'with specific parameters' do
let :params do
{
:amqp_pre_settled => ['rpc-cast','rpc-reply','notify'],
:amqp_idle_timeout => '100',
:amqp_allow_insecure_clients => 'yes',
:amqp_sasl_mechanisms => 'ANONYMOUS DIGEST-MD5 EXTERNAL PLAIN',
}
end
it { is_expected.to contain_class('keystone::messaging::amqp').with(
'amqp_pre_settled' => ['rpc-cast','rpc-reply','notify'],
'amqp_idle_timeout' => '100',
'amqp_allow_insecure_clients' => 'yes',
'amqp_sasl_mechanisms' => 'ANONYMOUS DIGEST-MD5 EXTERNAL PLAIN',
)}
end
context 'with AMQP 1.0 communication SSLed' do
let :params do
{
:amqp_ssl_ca_file => '/path/to/ssl/ca/certs',
:amqp_ssl_cert_file => '/path/to/ssl/cert/file',
:amqp_ssl_key_file => '/path/to/ssl/keyfile',
:amqp_ssl_key_password => '/path/to/ssl/pw_file',
}
end
it { is_expected.to contain_class('keystone::messaging::amqp').with(
'amqp_ssl_ca_file' => '/path/to/ssl/ca/certs',
'amqp_ssl_cert_file' => '/path/to/ssl/cert/file',
'amqp_ssl_key_file' => '/path/to/ssl/keyfile',
'amqp_ssl_key_password' => '/path/to/ssl/pw_file',
)}
end
end
on_supported_os({
:supported_os => OSDefaults.get_supported_os
}).each do |os,facts|
context "on #{os}" do
let (:facts) do
facts.merge!(OSDefaults.get_facts())
end
it_configures 'keystone messaging amqp'
end
end
end