Skip to content

Commit

Permalink
Refs #32037: Add parameters to disable qpid services
Browse files Browse the repository at this point in the history
  • Loading branch information
ehelms committed Mar 29, 2021
1 parent 6d3f06f commit 05ebea4
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 5 deletions.
8 changes: 7 additions & 1 deletion manifests/init.pp
Expand Up @@ -9,7 +9,7 @@
# $acl_file:: File name for Qpid ACL
#
# $acl_content:: Content for Access Control List file

#
# === SSL parameters
#
# $auth:: Use SASL authentication
Expand Down Expand Up @@ -61,6 +61,10 @@
# The settings with can't be set this way and will cause the
# server to refuse to start up.
#
# $service_ensure:: Specify if qpidd service should be running or stopped
#
# $service_enable:: Enable qpidd service at boot
#
class qpid (
String $version = $qpid::params::version,
Boolean $auth = $qpid::params::auth,
Expand All @@ -87,6 +91,8 @@
Optional[Integer[1]] $mgmt_pub_interval = $qpid::params::mgmt_pub_interval,
Optional[Integer[1]] $default_queue_limit = $qpid::params::default_queue_limit,
Hash[String, Variant[String, Integer]] $custom_settings = $qpid::params::custom_settings,
Boolean $service_ensure = true,
Optional[Boolean] $service_enable = undef,
) inherits qpid::params {
if $ssl {
assert_type(Boolean, $ssl_require_client_auth)
Expand Down
6 changes: 6 additions & 0 deletions manifests/router.pp
Expand Up @@ -16,6 +16,10 @@
# Frequency in seconds of sending heartbeats from this router
# @param hello_max_age
# Timeout of heartbeat before connections are dropped
# @param service_enable
# Enable/disable qdrouterd service at boot
# @param service_ensure
# Specify if qdrouterd should be running or stopped.
class qpid::router(
$router_id = $qpid::router::params::router_id,
$mode = $qpid::router::params::router_mode,
Expand All @@ -25,6 +29,8 @@
$worker_threads = $qpid::router::params::worker_threads,
$hello_interval = $qpid::router::params::hello_interval,
$hello_max_age = $qpid::router::params::hello_max_age,
$service_ensure = true,
$service_enable = true,
) inherits qpid::router::params {

contain qpid::router::install
Expand Down
4 changes: 2 additions & 2 deletions manifests/router/service.pp
Expand Up @@ -4,8 +4,8 @@
class qpid::router::service {

service { 'qdrouterd':
ensure => running,
enable => true,
ensure => $qpid::router::service_ensure,
enable => $qpid::router::service_enable,
hasstatus => true,
hasrestart => true,
}
Expand Down
4 changes: 2 additions & 2 deletions manifests/service.pp
Expand Up @@ -4,8 +4,8 @@
class qpid::service {

service { 'qpidd':
ensure => running,
enable => true,
ensure => $qpid::service_ensure,
enable => pick($qpid::service_enable, $qpid::service_ensure),
hasstatus => true,
hasrestart => true,
}
Expand Down
12 changes: 12 additions & 0 deletions spec/classes/qpid_spec.rb
Expand Up @@ -34,6 +34,18 @@
end
end

context 'with services stopped' do
let(:params) { super().merge(service_ensure: false) }

it { is_expected.to compile.with_all_deps }

it 'should disable qpidd' do
is_expected.to contain_service('qpidd')
.with_ensure('false')
.with_enable('false')
end
end

context 'with service limits' do
let(:params) { super().merge(open_file_limit: 100) }

Expand Down

0 comments on commit 05ebea4

Please sign in to comment.