File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1111
1212 case $ssh::server::validate_sshd_file {
1313 true: {
14- $sshd_validate_cmd = ' /usr/sbin/sshd -tf %'
14+ $sshd_validate_cmd = " ${ssh::server::sshd_binary} -tf %"
1515 }
1616 default: {
1717 $sshd_validate_cmd = undef
Original file line number Diff line number Diff line change 2222
2323 case $ssh::server::validate_sshd_file {
2424 true: {
25- $sshd_validate_cmd = ' /usr/sbin/sshd -tf %'
25+ $sshd_validate_cmd = " ${ssh::server::sshd_binary} -tf %"
2626 }
2727 default: {
2828 $sshd_validate_cmd = undef
Original file line number Diff line number Diff line change 4646 if $facts [' kernel' ] == ' Linux' {
4747 case $validate_config_file {
4848 true: {
49- $validate_cmd = ' /usr/sbin/sshd -tf %'
49+ $validate_cmd = " ${ssh::server::sshd_binary} -tf %"
5050 }
5151 default: {
5252 $validate_cmd = undef
Original file line number Diff line number Diff line change 134134 }
135135 end
136136
137- it { is_expected . to contain_concat ( '/etc/ssh/sshd_config' ) . with_validate_cmd ( '/usr/sbin/sshd -tf %' ) }
137+ sshd_binary = case os_facts [ :os ] [ 'family' ]
138+ when 'FreeBSD'
139+ '/usr/local/sbin/sshd'
140+ when 'Archlinux'
141+ '/usr/bin/sshd'
142+ else
143+ '/usr/sbin/sshd'
144+ end
145+ it { is_expected . to contain_concat ( '/etc/ssh/sshd_config' ) . with_validate_cmd ( "#{ sshd_binary } -tf %" ) }
138146 end
139147
140148 context 'without resource purging' do
Original file line number Diff line number Diff line change 8686 }
8787 end
8888
89- it { is_expected . to contain_concat ( '/etc/ssh/sshd_config' ) . with_validate_cmd ( '/usr/sbin/sshd -tf %' ) }
89+ sshd_binary = case os_facts [ :os ] [ 'family' ]
90+ when 'FreeBSD'
91+ '/usr/local/sbin/sshd'
92+ when 'Archlinux'
93+ '/usr/bin/sshd'
94+ else
95+ '/usr/sbin/sshd'
96+ end
97+ it { is_expected . to contain_concat ( '/etc/ssh/sshd_config' ) . with_validate_cmd ( "#{ sshd_binary } -tf %" ) }
98+ end
99+
100+ context 'with a different sshd_binary location' do
101+ let :params do
102+ {
103+ validate_sshd_file : true ,
104+ sshd_binary : '/usr/another_bin/sshd'
105+ }
106+ end
107+
108+ it { is_expected . to contain_concat ( '/etc/ssh/sshd_config' ) . with_validate_cmd ( '/usr/another_bin/sshd -tf %' ) }
90109 end
91110
92111 context 'with a different sshd_config location' do
You can’t perform that action at this time.
0 commit comments