Skip to content

Commit

Permalink
Merge pull request #1890 from bastelfreak/apt
Browse files Browse the repository at this point in the history
Debian: Replace apt-get with apt for updates
  • Loading branch information
ekohl authored Jul 24, 2024
2 parents 3d564e8 + 3149b00 commit 2be5851
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
6 changes: 4 additions & 2 deletions lib/beaker/host/unix/pkg.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ def update_apt_if_needed
return unless /debian|ubuntu/.match?(self['platform'])
return unless @apt_needs_update

execute("apt-get update")
# -qq: Only output errors to stdout
execute("apt-get update -qq")
@apt_needs_update = false
end

Expand Down Expand Up @@ -263,7 +264,8 @@ def install_local_package(onhost_package_file, onhost_copy_dir = nil)
execute("zypper --non-interactive --no-gpg-checks in #{onhost_package_file}")
when /^(debian|ubuntu)$/
execute("dpkg -i --force-all #{onhost_package_file}")
execute("apt-get update")
# -qq: Only output errors to stdout
execute("apt-get update -qq")
when /^solaris$/
self.solaris_install_local_package(onhost_package_file, onhost_copy_dir)
when /^osx$/
Expand Down
3 changes: 2 additions & 1 deletion lib/beaker/host_prebuilt_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,8 @@ def sync_root_keys host, opts
# @param [Host, Array<Host>] hosts One or more hosts to act upon
def apt_get_update hosts
block_on hosts do |host|
host.exec(Command.new("apt-get update")) if /ubuntu|debian/.match?(host[:platform])
# -qq: Only output errors to stdout
host.exec(Command.new("apt-get update -qq")) if /ubuntu|debian/.match?(host[:platform])
end
end

Expand Down
4 changes: 2 additions & 2 deletions spec/beaker/host/unix/pkg_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def exec
it "calls update for #{platform}" do
@opts = { 'platform' => platform }
instance.instance_variable_set(:@apt_needs_update, true)
expect(instance).to receive('execute').with("apt-get update")
expect(instance).to receive('execute').with("apt-get update -qq")
expect { instance.update_apt_if_needed }.not_to raise_error
end
end
Expand Down Expand Up @@ -309,7 +309,7 @@ def exec
%w[debian ubuntu].each do |platform|
@platform = platform
expect(instance).to receive(:execute).with(/^dpkg.*#{package_file}$/)
expect(instance).to receive(:execute).with('apt-get update')
expect(instance).to receive(:execute).with('apt-get update -qq')
instance.install_local_package(package_file)
end
end
Expand Down
4 changes: 2 additions & 2 deletions spec/beaker/host_prebuilt_steps_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -227,15 +227,15 @@
it "can perform apt-get on ubuntu hosts" do
host = make_host('testhost', { :platform => 'ubuntu' })

expect(Beaker::Command).to receive(:new).with("apt-get update").once
expect(Beaker::Command).to receive(:new).with("apt-get update -qq").once

subject.apt_get_update(host)
end

it "can perform apt-get on debian hosts" do
host = make_host('testhost', { :platform => 'debian' })

expect(Beaker::Command).to receive(:new).with("apt-get update").once
expect(Beaker::Command).to receive(:new).with("apt-get update -qq").once

subject.apt_get_update(host)
end
Expand Down

0 comments on commit 2be5851

Please sign in to comment.