Skip to content

Commit b051aa8

Browse files
authored
Merge pull request #1374 from ekohl/clean-up-dependency-install
Rewrite dependency installation using native Puppet
2 parents 7860557 + ec15449 commit b051aa8

File tree

1 file changed

+21
-26
lines changed

1 file changed

+21
-26
lines changed

spec/spec_helper_acceptance_local.rb

Lines changed: 21 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@ def unindent
1515

1616
RSpec.configure do |c|
1717
c.before :suite do
18-
# Install iproute on AlmaLinux
19-
# Package is used to check if ports are listening
20-
LitmusHelper.instance.run_shell('sudo dnf install iproute -y') if %r{redhat}.match?(os[:family]) && os[:release].to_f >= 8
21-
2218
install_dependencies
2319
end
2420
end
@@ -41,32 +37,31 @@ def pre_run
4137
end
4238

4339
def install_dependencies
44-
iproute2 = <<-MANIFEST
45-
package { 'iproute2': ensure => installed }
46-
MANIFEST
47-
LitmusHelper.instance.apply_manifest(iproute2) if os[:family] == 'ubuntu' && os[:release].start_with?('18.04')
48-
49-
netstat = <<-MANIFEST
50-
# needed for netstat, for serverspec checks
51-
if $::osfamily == 'SLES' or $::osfamily == 'SUSE' {
52-
package { 'net-tools-deprecated':
53-
ensure => 'latest',
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+
}
5445
}
55-
}
56-
MANIFEST
57-
58-
LitmusHelper.instance.apply_manifest(netstat)
5946
60-
return unless os[:family] == 'redhat' && os[:release].start_with?('6', '7', '8')
61-
62-
policycoreutils_pkg = 'policycoreutils-python' if os[:release].start_with?('6', '7')
63-
policycoreutils_pkg = 'policycoreutils-python-utils' if os[:release].start_with?('8')
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+
}
6453
65-
selinux = <<-MANIFEST
66-
package { '#{policycoreutils_pkg}': ensure => installed }
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+
}
6764
MANIFEST
68-
69-
LitmusHelper.instance.apply_manifest(selinux)
7065
end
7166

7267
def postgresql_version

0 commit comments

Comments
 (0)