Skip to content

Commit 9191207

Browse files
committed
Extract acceptance node setup to its own file
This is a pattern we use in Vox Pupuli. In fact, voxpupuli-acceptance does this if it detects the file automatically. The biggest benefit is that editors and linters can work on the file, which increases quality.
1 parent 54602cd commit 9191207

File tree

2 files changed

+24
-25
lines changed

2 files changed

+24
-25
lines changed

spec/setup_acceptance_node.pp

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
if $facts['os']['name'] == 'Ubuntu' and $facts['os']['release']['major'] == '18.04' {
2+
package { 'iproute2':
3+
ensure => installed,
4+
}
5+
}
6+
7+
# needed for netstat, for serverspec checks
8+
if $facts['os']['family'] in ['SLES', 'SUSE'] {
9+
package { 'net-tools-deprecated':
10+
ensure => 'latest',
11+
}
12+
}
13+
14+
if $facts['os']['family'] == 'RedHat' {
15+
if versioncmp($facts['os']['release']['major'], '8') >= 0 {
16+
$package = ['iproute', 'policycoreutils-python-utils']
17+
} else {
18+
$package = 'policycoreutils-python'
19+
}
20+
package { $package:
21+
ensure => installed,
22+
}
23+
}

spec/spec_helper_acceptance_local.rb

+1-25
Original file line numberDiff line numberDiff line change
@@ -37,31 +37,7 @@ def pre_run
3737
end
3838

3939
def install_dependencies
40-
LitmusHelper.instance.apply_manifest <<~MANIFEST
41-
if $facts['os']['name'] == 'Ubuntu' and $facts['os']['release']['major'] == '18.04' {
42-
package { 'iproute2':
43-
ensure => installed,
44-
}
45-
}
46-
47-
# needed for netstat, for serverspec checks
48-
if $facts['os']['family'] in ['SLES', 'SUSE'] {
49-
package { 'net-tools-deprecated':
50-
ensure => 'latest',
51-
}
52-
}
53-
54-
if $facts['os']['family'] == 'RedHat' {
55-
if versioncmp($facts['os']['release']['major'], '8') >= 0 {
56-
$package = ['iproute', 'policycoreutils-python-utils']
57-
} else {
58-
$package = 'policycoreutils-python'
59-
}
60-
package { $package:
61-
ensure => installed,
62-
}
63-
}
64-
MANIFEST
40+
LitmusHelper.instance.apply_manifest(File.read(File.join(__dir__, 'setup_acceptance_node.pp')))
6541
end
6642

6743
def postgresql_version

0 commit comments

Comments
 (0)