|
140 | 140 | it { is_expected.to compile.with_all_deps } |
141 | 141 | it { is_expected.not_to contain_ssh__client__config_file('custom') } |
142 | 142 | end |
| 143 | + |
| 144 | + context 'with use_augeas enabled' do |
| 145 | + let :pre_condition do |
| 146 | + 'define ssh_config ($ensure = present, $key = undef, $value = undef, $target = undef, $host = undef) {}' |
| 147 | + end |
| 148 | + |
| 149 | + let :params do |
| 150 | + { |
| 151 | + use_augeas: true, |
| 152 | + options: { |
| 153 | + 'ForwardAgent' => 'no', |
| 154 | + 'StrictHostKeyChecking' => 'ask', |
| 155 | + }, |
| 156 | + options_absent: ['GSSAPIAuthentication'], |
| 157 | + } |
| 158 | + end |
| 159 | + |
| 160 | + it { is_expected.to compile.with_all_deps } |
| 161 | + it { is_expected.not_to contain_concat('/etc/ssh/ssh_config') } |
| 162 | + |
| 163 | + it { |
| 164 | + is_expected.to contain_ssh_config('ForwardAgent').with( |
| 165 | + ensure: 'present', |
| 166 | + key: 'ForwardAgent', |
| 167 | + value: 'no', |
| 168 | + target: '/etc/ssh/ssh_config', |
| 169 | + ) |
| 170 | + } |
| 171 | + |
| 172 | + it { |
| 173 | + is_expected.to contain_ssh_config('StrictHostKeyChecking').with( |
| 174 | + ensure: 'present', |
| 175 | + key: 'StrictHostKeyChecking', |
| 176 | + value: 'ask', |
| 177 | + ) |
| 178 | + } |
| 179 | + |
| 180 | + it { |
| 181 | + is_expected.to contain_ssh_config('GSSAPIAuthentication').with( |
| 182 | + ensure: 'absent', |
| 183 | + key: 'GSSAPIAuthentication', |
| 184 | + ) |
| 185 | + } |
| 186 | + end |
| 187 | + |
| 188 | + context 'with use_augeas and host block options' do |
| 189 | + let :pre_condition do |
| 190 | + 'define ssh_config ($ensure = present, $key = undef, $value = undef, $target = undef, $host = undef) {}' |
| 191 | + end |
| 192 | + |
| 193 | + let :params do |
| 194 | + { |
| 195 | + use_augeas: true, |
| 196 | + options: { |
| 197 | + 'Host *.example.com' => { |
| 198 | + 'ForwardAgent' => 'yes', |
| 199 | + 'BatchMode' => 'yes', |
| 200 | + }, |
| 201 | + }, |
| 202 | + options_absent: [], |
| 203 | + } |
| 204 | + end |
| 205 | + |
| 206 | + it { is_expected.to compile.with_all_deps } |
| 207 | + |
| 208 | + it { |
| 209 | + is_expected.to contain_ssh_config('ForwardAgent *.example.com').with( |
| 210 | + ensure: 'present', |
| 211 | + host: '*.example.com', |
| 212 | + key: 'ForwardAgent', |
| 213 | + value: 'yes', |
| 214 | + ) |
| 215 | + } |
| 216 | + |
| 217 | + it { |
| 218 | + is_expected.to contain_ssh_config('BatchMode *.example.com').with( |
| 219 | + ensure: 'present', |
| 220 | + host: '*.example.com', |
| 221 | + key: 'BatchMode', |
| 222 | + value: 'yes', |
| 223 | + ) |
| 224 | + } |
| 225 | + end |
143 | 226 | end |
144 | 227 | end |
145 | 228 | end |
0 commit comments