Support [queue] asynchronous_workers option
... which determines number of processes launched in barbican-worker. Change-Id: Ia31a7d440ba3102afa7b5972fe893cfb4f1817a1
This commit is contained in:
@@ -33,10 +33,15 @@
|
|||||||
# (Optional) Whether to enable the barbican-worker service.
|
# (Optional) Whether to enable the barbican-worker service.
|
||||||
# Defaults to true
|
# Defaults to true
|
||||||
#
|
#
|
||||||
|
# [*workers*]
|
||||||
|
# (Optional) Number of asynchronous worker process.
|
||||||
|
# Defaults to $facts['os_service_default']
|
||||||
|
#
|
||||||
class barbican::worker (
|
class barbican::worker (
|
||||||
$package_ensure = 'present',
|
$package_ensure = 'present',
|
||||||
Boolean $manage_service = true,
|
Boolean $manage_service = true,
|
||||||
Boolean $enabled = true,
|
Boolean $enabled = true,
|
||||||
|
$workers = $facts['os_service_default'],
|
||||||
) inherits barbican::params {
|
) inherits barbican::params {
|
||||||
|
|
||||||
include barbican::deps
|
include barbican::deps
|
||||||
@@ -47,6 +52,10 @@ class barbican::worker (
|
|||||||
tag => ['openstack', 'barbican-package'],
|
tag => ['openstack', 'barbican-package'],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
barbican_config {
|
||||||
|
'queue/asynchronous_workers': value => $workers;
|
||||||
|
}
|
||||||
|
|
||||||
if $manage_service {
|
if $manage_service {
|
||||||
if $enabled {
|
if $enabled {
|
||||||
$service_ensure = 'running'
|
$service_ensure = 'running'
|
||||||
|
@@ -0,0 +1,4 @@
|
|||||||
|
---
|
||||||
|
features:
|
||||||
|
- |
|
||||||
|
The new ``barbican::worker::workers`` parameter has been added.
|
@@ -19,10 +19,6 @@
|
|||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
describe 'barbican::worker' do
|
describe 'barbican::worker' do
|
||||||
let :params do
|
|
||||||
{}
|
|
||||||
end
|
|
||||||
|
|
||||||
shared_examples 'barbican::worker' do
|
shared_examples 'barbican::worker' do
|
||||||
context 'with default parameters' do
|
context 'with default parameters' do
|
||||||
it { should contain_package('barbican-worker').with(
|
it { should contain_package('barbican-worker').with(
|
||||||
@@ -31,6 +27,8 @@ describe 'barbican::worker' do
|
|||||||
:tag => ['openstack', 'barbican-package']
|
:tag => ['openstack', 'barbican-package']
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
it { should contain_barbican_config('queue/asynchronous_workers').with_value('<SERVICE DEFAULT>') }
|
||||||
|
|
||||||
it { should contain_service('barbican-worker').with(
|
it { should contain_service('barbican-worker').with(
|
||||||
:ensure => 'running',
|
:ensure => 'running',
|
||||||
:name => platform_params[:worker_service_name],
|
:name => platform_params[:worker_service_name],
|
||||||
@@ -41,17 +39,24 @@ describe 'barbican::worker' do
|
|||||||
)}
|
)}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context 'with parameters' do
|
||||||
|
let :params do
|
||||||
|
{ :workers => 2 }
|
||||||
|
end
|
||||||
|
it { should contain_barbican_config('queue/asynchronous_workers').with_value(2) }
|
||||||
|
end
|
||||||
|
|
||||||
context 'with package_ensure set to absent' do
|
context 'with package_ensure set to absent' do
|
||||||
before do
|
let :params do
|
||||||
params.merge!( :package_ensure => 'absent' )
|
{ :package_ensure => 'absent' }
|
||||||
end
|
end
|
||||||
|
|
||||||
it { should contain_package('barbican-worker').with_ensure('absent') }
|
it { should contain_package('barbican-worker').with_ensure('absent') }
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'with manage_service set to false' do
|
context 'with manage_service set to false' do
|
||||||
before do
|
let :params do
|
||||||
params.merge!( :manage_service => false )
|
{ :manage_service => false }
|
||||||
end
|
end
|
||||||
|
|
||||||
it { should contain_package('barbican-worker').with_ensure('present') }
|
it { should contain_package('barbican-worker').with_ensure('present') }
|
||||||
@@ -59,8 +64,8 @@ describe 'barbican::worker' do
|
|||||||
end
|
end
|
||||||
|
|
||||||
context 'with enabled set to false' do
|
context 'with enabled set to false' do
|
||||||
before do
|
let :params do
|
||||||
params.merge!( :enabled => false )
|
{ :enabled => false }
|
||||||
end
|
end
|
||||||
|
|
||||||
it { should contain_package('barbican-worker').with_ensure('present') }
|
it { should contain_package('barbican-worker').with_ensure('present') }
|
||||||
|
Reference in New Issue
Block a user