Install and enable keystone-listner
To use the keystone notification feature, we need an independent keyston-listner service. This change implements the missing capability to manage the service and its package. Closes-Bug: #1956397 Change-Id: Iedda0e9fe7b091b510ea9033db86921e4d2b4184
This commit is contained in:
parent
47729d343f
commit
d6bbb2c583
|
@ -24,15 +24,28 @@
|
|||
# (optional) max threads to be used for notification server
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*package_ensure*]
|
||||
# (Optional) The state of the barbican-keystone-listener package.
|
||||
# Defaults to 'present'
|
||||
#
|
||||
# [*manage_service*]
|
||||
# (Optional) If we should manage the barbican-keystone-listener service.
|
||||
# Defaults to true
|
||||
#
|
||||
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,
|
||||
$package_ensure = 'present',
|
||||
$manage_service = true,
|
||||
) {
|
||||
|
||||
include barbican::deps
|
||||
include barbican::params
|
||||
|
||||
validate_legacy(Boolean, 'validate_bool', $manage_service)
|
||||
|
||||
barbican_config {
|
||||
'keystone_notifications/enable': value => $enable_keystone_notification;
|
||||
|
@ -41,4 +54,34 @@ class barbican::keystone::notification (
|
|||
'keystone_notifications/allow_requeue': value => $keystone_notification_allow_requeue;
|
||||
'keystone_notifications/thread_pool_size': value => $keystone_notification_thread_pool_size;
|
||||
}
|
||||
|
||||
package { 'barbican-keystone-listener':
|
||||
ensure => $package_ensure,
|
||||
name => $::barbican::params::keystone_listener_package_name,
|
||||
tag => ['openstack', 'barbican-package'],
|
||||
}
|
||||
|
||||
if is_service_default($enable_keystone_notification) {
|
||||
$service_enabled = false
|
||||
} else {
|
||||
validate_legacy(Boolean, 'validate_bool', $enable_keystone_notification)
|
||||
$service_enabled = $enable_keystone_notification
|
||||
}
|
||||
|
||||
if $manage_service {
|
||||
if $service_enabled {
|
||||
$service_ensure = 'running'
|
||||
} else {
|
||||
$service_ensure = 'stopped'
|
||||
}
|
||||
|
||||
service { 'barbican-keystone-listener':
|
||||
ensure => $service_ensure,
|
||||
name => $::barbican::params::keystone_listener_service_name,
|
||||
enable => $service_enabled,
|
||||
hasstatus => true,
|
||||
hasrestart => true,
|
||||
tag => 'barbican-service',
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,22 +11,26 @@ class barbican::params {
|
|||
|
||||
case $::osfamily {
|
||||
'RedHat': {
|
||||
$api_package_name = 'openstack-barbican-api'
|
||||
$api_service_name = 'openstack-barbican-api'
|
||||
$worker_package_name = 'openstack-barbican-worker'
|
||||
$worker_service_name = 'openstack-barbican-worker'
|
||||
$barbican_wsgi_script_path = '/var/www/cgi-bin/barbican'
|
||||
$barbican_wsgi_script_source = '/usr/bin/barbican-wsgi-api'
|
||||
$httpd_config_file = '/etc/httpd/conf.d/barbican-api.conf'
|
||||
$api_package_name = 'openstack-barbican-api'
|
||||
$api_service_name = 'openstack-barbican-api'
|
||||
$worker_package_name = 'openstack-barbican-worker'
|
||||
$worker_service_name = 'openstack-barbican-worker'
|
||||
$keystone_listener_package_name = 'openstack-barbican-keystone-listener'
|
||||
$keystone_listener_service_name = 'openstack-barbican-keystone-listener'
|
||||
$barbican_wsgi_script_path = '/var/www/cgi-bin/barbican'
|
||||
$barbican_wsgi_script_source = '/usr/bin/barbican-wsgi-api'
|
||||
$httpd_config_file = '/etc/httpd/conf.d/barbican-api.conf'
|
||||
}
|
||||
'Debian': {
|
||||
$api_service_name = 'barbican-api'
|
||||
$api_package_name = 'barbican-api'
|
||||
$worker_package_name = 'barbican-worker'
|
||||
$worker_service_name = 'barbican-worker'
|
||||
$barbican_wsgi_script_path = '/usr/lib/cgi-bin/barbican'
|
||||
$barbican_wsgi_script_source = '/usr/bin/barbican-wsgi-api'
|
||||
$httpd_config_file = '/etc/apache2/conf-available/barbican-api.conf'
|
||||
$api_service_name = 'barbican-api'
|
||||
$api_package_name = 'barbican-api'
|
||||
$worker_package_name = 'barbican-worker'
|
||||
$worker_service_name = 'barbican-worker'
|
||||
$keystone_listener_package_name = 'barbican-keystone-listener'
|
||||
$keystone_listener_service_name = 'barbican-keystone-listener'
|
||||
$barbican_wsgi_script_path = '/usr/lib/cgi-bin/barbican'
|
||||
$barbican_wsgi_script_source = '/usr/bin/barbican-wsgi-api'
|
||||
$httpd_config_file = '/etc/apache2/conf-available/barbican-api.conf'
|
||||
}
|
||||
default: {
|
||||
fail("Unsupported osfamily: ${::osfamily} operating system")
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
fixes:
|
||||
- |
|
||||
Now the ``barbican::keystone::notification`` class manages the service and
|
||||
the package to use the keystone notification feature.
|
|
@ -53,7 +53,7 @@ describe 'barbican::keystone::notification' do
|
|||
param_set
|
||||
end
|
||||
|
||||
it 'is_expected.to set keystone notification parameters' do
|
||||
it 'configures 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')\
|
||||
|
@ -65,6 +65,36 @@ describe 'barbican::keystone::notification' do
|
|||
is_expected.to contain_barbican_config('keystone_notifications/control_exchange')\
|
||||
.with_value(param_hash[:keystone_notification_control_exchange])
|
||||
end
|
||||
|
||||
it 'installs the keystone listner package' do
|
||||
is_expected.to contain_package('barbican-keystone-listener').with(
|
||||
:ensure => 'present',
|
||||
:name => platform_params[:keystone_listener_package_name],
|
||||
:tag => ['openstack', 'barbican-package']
|
||||
)
|
||||
end
|
||||
|
||||
it 'manages the keystone listener service' do
|
||||
if params[:enable_keystone_notification] == true
|
||||
is_expected.to contain_service('barbican-keystone-listener').with(
|
||||
:ensure => 'running',
|
||||
:name => platform_params[:keystone_listener_service_name],
|
||||
:enable => true,
|
||||
:hasstatus => true,
|
||||
:hasrestart => true,
|
||||
:tag => 'barbican-service',
|
||||
)
|
||||
else
|
||||
is_expected.to contain_service('barbican-keystone-listener').with(
|
||||
:ensure => 'stopped',
|
||||
:name => platform_params[:keystone_listener_service_name],
|
||||
:enable => false,
|
||||
:hasstatus => true,
|
||||
:hasrestart => true,
|
||||
:tag => 'barbican-service',
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -74,11 +104,22 @@ describe 'barbican::keystone::notification' do
|
|||
}).each do |os,facts|
|
||||
context "on #{os}" do
|
||||
let (:facts) do
|
||||
facts.merge(OSDefaults.get_facts({
|
||||
:processorcount => 8,
|
||||
:fqdn => 'some.host.tld',
|
||||
:concat_basedir => '/var/lib/puppet/concat',
|
||||
}))
|
||||
facts.merge(OSDefaults.get_facts())
|
||||
end
|
||||
|
||||
let (:platform_params) do
|
||||
case facts[:osfamily]
|
||||
when 'RedHat'
|
||||
{
|
||||
:keystone_listener_package_name => 'openstack-barbican-keystone-listener',
|
||||
:keystone_listener_service_name => 'openstack-barbican-keystone-listener',
|
||||
}
|
||||
when 'Debian'
|
||||
{
|
||||
:keystone_listener_package_name => 'barbican-keystone-listener',
|
||||
:keystone_listener_service_name => 'barbican-keystone-listener',
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
it_configures 'barbican keystone notification'
|
||||
|
|
Loading…
Reference in New Issue