Skip to content
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
2 changes: 1 addition & 1 deletion manifests/server/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

case $ssh::server::validate_sshd_file {
true: {
$sshd_validate_cmd = '/usr/sbin/sshd -tf %'
$sshd_validate_cmd = "${ssh::server::sshd_binary} -tf %"
}
default: {
$sshd_validate_cmd = undef
Expand Down
2 changes: 1 addition & 1 deletion manifests/server/config_file.pp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

case $ssh::server::validate_sshd_file {
true: {
$sshd_validate_cmd = '/usr/sbin/sshd -tf %'
$sshd_validate_cmd = "${ssh::server::sshd_binary} -tf %"
}
default: {
$sshd_validate_cmd = undef
Expand Down
2 changes: 1 addition & 1 deletion manifests/server/instances.pp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
if $facts['kernel'] == 'Linux' {
case $validate_config_file {
true: {
$validate_cmd = '/usr/sbin/sshd -tf %'
$validate_cmd = "${ssh::server::sshd_binary} -tf %"
}
default: {
$validate_cmd = undef
Expand Down
10 changes: 9 additions & 1 deletion spec/classes/init_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,15 @@
}
end

it { is_expected.to contain_concat('/etc/ssh/sshd_config').with_validate_cmd('/usr/sbin/sshd -tf %') }
sshd_binary = case os_facts[:os]['family']
when 'FreeBSD'
'/usr/local/sbin/sshd'
when 'Archlinux'
'/usr/bin/sshd'
else
'/usr/sbin/sshd'
end
it { is_expected.to contain_concat('/etc/ssh/sshd_config').with_validate_cmd("#{sshd_binary} -tf %") }
end

context 'without resource purging' do
Expand Down
21 changes: 20 additions & 1 deletion spec/classes/server_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,26 @@
}
end

it { is_expected.to contain_concat('/etc/ssh/sshd_config').with_validate_cmd('/usr/sbin/sshd -tf %') }
sshd_binary = case os_facts[:os]['family']
when 'FreeBSD'
'/usr/local/sbin/sshd'
when 'Archlinux'
'/usr/bin/sshd'
else
'/usr/sbin/sshd'
end
it { is_expected.to contain_concat('/etc/ssh/sshd_config').with_validate_cmd("#{sshd_binary} -tf %") }
end

context 'with a different sshd_binary location' do
let :params do
{
validate_sshd_file: true,
sshd_binary: '/usr/another_bin/sshd'
}
end

it { is_expected.to contain_concat('/etc/ssh/sshd_config').with_validate_cmd('/usr/another_bin/sshd -tf %') }
end

context 'with a different sshd_config location' do
Expand Down
Loading