|
9 | 9 | facts |
10 | 10 | end |
11 | 11 |
|
12 | | - is_supported_debian_version = if facts[:os]['family'] == 'Debian' && %w[9 10].include?(facts[:os]['release']['major']) |
13 | | - true |
14 | | - else |
15 | | - false |
16 | | - end |
17 | | - |
18 | | - native_debian_devel_package = if facts[:os]['name'] == 'Ubuntu' && facts[:os]['release']['major'] == '20.04' |
| 12 | + native_debian_devel_package = if facts[:os]['name'] == 'Ubuntu' && Gem::Version.new(facts[:os]['release']['major']) >= Gem::Version.new('20.04') |
| 13 | + 'libnode-dev' |
| 14 | + elsif facts[:os]['name'] == 'Debian' && Gem::Version.new(facts[:os]['release']['major']) >= Gem::Version.new(10) |
19 | 15 | 'libnode-dev' |
20 | 16 | else |
21 | 17 | 'nodejs-dev' |
|
199 | 195 | } |
200 | 196 | end |
201 | 197 |
|
202 | | - if is_supported_debian_version |
203 | | - |
204 | | - it 'the nodejs development package resource should not be present' do |
205 | | - is_expected.not_to contain_package(native_debian_devel_package) |
206 | | - end |
207 | | - else |
208 | | - it 'the nodejs development package should be installed' do |
209 | | - is_expected.to contain_package(native_debian_devel_package).with('ensure' => 'present') |
210 | | - end |
| 198 | + it 'the nodejs development package should be installed' do |
| 199 | + is_expected.to contain_package(native_debian_devel_package).with('ensure' => 'present') |
211 | 200 | end |
212 | 201 | end |
213 | 202 |
|
|
218 | 207 | } |
219 | 208 | end |
220 | 209 |
|
221 | | - if is_supported_debian_version |
222 | | - |
223 | | - it 'the nodejs development package resource should not be present' do |
224 | | - is_expected.not_to contain_package(native_debian_devel_package) |
225 | | - end |
226 | | - else |
227 | | - it 'the nodejs development package should not be present' do |
228 | | - is_expected.to contain_package(native_debian_devel_package).with('ensure' => 'absent') |
229 | | - end |
| 210 | + it 'the nodejs development package should not be present' do |
| 211 | + is_expected.to contain_package(native_debian_devel_package).with('ensure' => 'absent') |
230 | 212 | end |
231 | 213 | end |
232 | 214 |
|
|
263 | 245 | } |
264 | 246 | end |
265 | 247 |
|
266 | | - if is_supported_debian_version |
267 | | - |
| 248 | + # Debian 9 (stretch) doesn't have npm in the standard repositories (it has been backported though). |
| 249 | + if facts[:os]['family'] == 'Debian' && facts[:os]['release']['major'] == '9' |
268 | 250 | it 'the npm package resource should not be present' do |
269 | 251 | is_expected.not_to contain_package('npm') |
270 | 252 | end |
|
282 | 264 | } |
283 | 265 | end |
284 | 266 |
|
285 | | - if is_supported_debian_version |
286 | | - |
| 267 | + # Debian 9 (stretch) doesn't have npm in the standard repositories (it has been backported though). |
| 268 | + if facts[:os]['family'] == 'Debian' && facts[:os]['release']['major'] == '9' |
287 | 269 | it 'the npm package resource should not be present' do |
288 | 270 | is_expected.not_to contain_package('npm') |
289 | 271 | end |
|
0 commit comments