Skip to content

Commit

Permalink
Autorequire dirmngr in apt_key types
Browse files Browse the repository at this point in the history
  • Loading branch information
ekohl committed Nov 14, 2018
1 parent c84e842 commit 53ea6e7
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 26 deletions.
4 changes: 4 additions & 0 deletions lib/puppet/type/apt_key.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@
end
end

autorequire(:package) do
'dirmngr'
end

newparam(:server) do
desc 'The key server to fetch the key from based on the ID. It can either be a domain name or url.'
defaultto :'keyserver.ubuntu.com'
Expand Down
16 changes: 0 additions & 16 deletions manifests/key.pp
Original file line number Diff line number Diff line change
Expand Up @@ -57,22 +57,6 @@
server => $server,
options => $options,
} -> anchor { "apt_key ${id} present": }

case $facts['os']['name'] {
'Debian': {
if versioncmp($facts['os']['release']['major'], '9') >= 0 {
ensure_packages(['dirmngr'])
Apt::Key<| title == $title |>
}
}
'Ubuntu': {
if versioncmp($facts['os']['release']['full'], '17.04') >= 0 {
ensure_packages(['dirmngr'])
Apt::Key<| title == $title |>
}
}
default: { }
}
}
}

Expand Down
10 changes: 0 additions & 10 deletions spec/acceptance/apt_key_provider_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -665,12 +665,6 @@ def apply_manifest_twice(manifest_pp)
}
MANIFEST

refresh_check_for_dirmngr_pp = <<-MANIFEST
package { 'dirmngr':
ensure => 'present',
}
MANIFEST

describe 'apt_key' do
before(:each) do
# Delete twice to make sure everything is cleaned
Expand Down Expand Up @@ -977,10 +971,6 @@ def apply_manifest_twice(manifest_pp)
let(:puppetlabs_exp_check_command) { PUPPETLABS_EXP_CHECK_COMMAND }
end
before(:each) do
if fact('lsbdistcodename') == 'stretch' || fact('lsbdistcodename') == 'bionic'
# Ensure dirmngr package is installed
apply_manifest(refresh_check_for_dirmngr_pp, acceptable_exit_codes: [0, 2])
end
# Delete the Puppet Labs Release Key and install an expired version of the key
apply_manifest(refresh_del_key_pp)
apply_manifest(refresh_pp, catch_failures: true)
Expand Down

0 comments on commit 53ea6e7

Please sign in to comment.