Skip to content

Commit

Permalink
Ruby style updates
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
mhashizume committed Nov 25, 2024
1 parent 7f54e44 commit d8a2f86
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions acceptance/lib/puppet/acceptance/rpm_util.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,13 @@ module RpmUtils

def rpm_provider(agent)
has_dnf = on(agent, 'which dnf', :acceptable_exit_codes => [0,1]).exit_code
if has_dnf == 0
'dnf'
else
'yum'
end
has_dnf == 0 ? 'dnf' : 'yum'
end

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

0 comments on commit d8a2f86

Please sign in to comment.