Skip to content

Commit

Permalink
Correct Amazon package manager
Browse files Browse the repository at this point in the history
73edd1a backported Amazon Linux support from master to 4.x. However,
because the commit did not apply cleanly, the install_package method
mistakenly uses Yum on Amazon Linux 2023.

DNF is the default package manager for Amazon Linux 2023 and Beaker 5.x
correctly uses DNF in the install_package method.

This commit changes Amazon Linux 2023 to use DNF instead of Yum in the
install_package method.
  • Loading branch information
mhashizume committed Nov 20, 2023
1 parent 857ef94 commit 8a96286
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/beaker/host/unix/pkg.rb
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,12 @@ def install_package(name, cmdline_args = '', version = nil, opts = {})
execute("zypper --non-interactive --gpg-auto-import-keys in #{name}", opts)
when /el-4/
@logger.debug("Package installation not supported on rhel4")
when /fedora-(2[2-9]|3[0-9])/
when /amazon-2023|fedora-(2[2-9]|3[0-9])/
if version
name = "#{name}-#{version}"
end
execute("dnf -y #{cmdline_args} install #{name}", opts)
when /amazon-2023|cisco|fedora|centos|redhat|eos|el-/
when /cisco|fedora|centos|redhat|eos|el-/
if version
name = "#{name}-#{version}"
end
Expand Down
2 changes: 1 addition & 1 deletion spec/beaker/host/unix/pkg_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ def exec
it "uses dnf on amazon-2023" do
@opts = { 'platform' => "amazon-2023-is-me" }
pkg = 'amazon_package'
expect(Beaker::Command).to receive(:new).with("yum -y install #{pkg}", [], { :prepend_cmds => nil, :cmdexe => false }).and_return('')
expect(Beaker::Command).to receive(:new).with("dnf -y install #{pkg}", [], { :prepend_cmds => nil, :cmdexe => false }).and_return('')
expect(instance).to receive(:exec).with('', {}).and_return(generate_result("hello", { :exit_code => 0 }))
expect(instance.install_package(pkg)).to be == "hello"
end
Expand Down

0 comments on commit 8a96286

Please sign in to comment.