Skip to content

Commit d8a2f86

Browse files
committed
Ruby style updates
This commit updates the RPM util test to use a ternary operator instead of a longer if...else statement and to use a string-array literal for brevity.
1 parent 7f54e44 commit d8a2f86

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

acceptance/lib/puppet/acceptance/rpm_util.rb

+2-6
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,13 @@ module RpmUtils
77

88
def rpm_provider(agent)
99
has_dnf = on(agent, 'which dnf', :acceptable_exit_codes => [0,1]).exit_code
10-
if has_dnf == 0
11-
'dnf'
12-
else
13-
'yum'
14-
end
10+
has_dnf == 0 ? 'dnf' : 'yum'
1511
end
1612

1713
def setup(agent)
1814
@@setup_packages[agent] ||= {}
1915
cmd = rpm_provider(agent)
20-
required_packages = ['createrepo', 'curl', 'rpm-build']
16+
required_packages = %w[createrepo curl rpm-build]
2117
required_packages.each do |pkg|
2218
pkg_installed = (on agent, "#{cmd} list installed #{pkg}", :acceptable_exit_codes => (0..255)).exit_code == 0
2319
# We need a newer OpenSSH for the newer OpenSSL that curl installs

0 commit comments

Comments
 (0)