Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refs #32037: Add parameters to disable qpid services #148

Merged
merged 1 commit into from Mar 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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

#
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice additional fix that we should have caught earlier

# === 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 = undef,
Comment on lines +32 to +33
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would have liked to see data types here. Ideally whenever you add a parameter, you use a data type.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given this class did not have data types already, it was either add it just for these two, add it for all (and possibly overreach the point of the PR) or stick with what was present already. I chose the latter to make the focused changed. And plan to follow up adding types.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#152 for those reading along :)

) 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 => pick($qpid::router::service_enable, $qpid::router::service_ensure),
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
16 changes: 16 additions & 0 deletions spec/classes/qpid_router_spec.rb
Expand Up @@ -66,6 +66,22 @@
end
end

context 'with services stopped' do
let(:params) do
{
service_ensure: false
}
end

it { is_expected.to compile.with_all_deps }

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

context 'with hello tuning params set' do
let :params do
{
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