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

Allow user-defined service restart parameter. #57

Merged
merged 1 commit into from
Apr 3, 2014
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@
# [*package_name*]
# The package name to install containing haproxy. Defaults to <code>'haproxy'</code>
#
#[*restart_command*]
# Command to use when restarting the on config changes.
# Passed directly as the <code>'restart'</code> parameter to the service resource.
# Defaults to undef i.e. whatever the service default is.
#
# === Examples
#
# class { 'haproxy':
Expand Down Expand Up @@ -66,7 +71,8 @@
$enable = true,
$global_options = $haproxy::params::global_options,
$defaults_options = $haproxy::params::defaults_options,
$package_name = 'haproxy'
$package_name = 'haproxy',
$restart_command = undef
) inherits haproxy::params {
include concat::setup

Expand Down Expand Up @@ -148,6 +154,7 @@
hasrestart => true,
hasstatus => true,
require => $deps,
restart => $restart_command,
}
}
}
16 changes: 16 additions & 0 deletions spec/classes/haproxy_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,22 @@
subject.should_not contain_service('haproxy')
end
end
context "on #{osfamily} when specifying a restart_command" do
let(:facts) do
{ :osfamily => osfamily }.merge default_facts
end
let(:params) do
{
'restart_command' => '/etc/init.d/haproxy reload',
'manage_service' => true,
}
end
it 'should set the haproxy package' do
subject.should contain_service('haproxy').with(
'restart' => '/etc/init.d/haproxy reload'
)
end
end
end
end
describe 'for OS-specific configuration' do
Expand Down