From a3d4822920ac0fb21f3443e0860f83f7daf04fbe Mon Sep 17 00:00:00 2001 From: Morgan Haskel Date: Thu, 2 Oct 2014 17:21:46 -0500 Subject: [PATCH] apt-key doesn't add long keys in deb6 You can feed the command the long key, but it truncates it to add the key. This causes issues due to the short-key collision with the puppetlabs key. So, test with a different key on debian 6. --- spec/acceptance/apt_key_provider_spec.rb | 26 ++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/spec/acceptance/apt_key_provider_spec.rb b/spec/acceptance/apt_key_provider_spec.rb index 69f7a93..3f2536c 100644 --- a/spec/acceptance/apt_key_provider_spec.rb +++ b/spec/acceptance/apt_key_provider_spec.rb @@ -64,6 +64,32 @@ describe 'apt_key' do describe 'ensure =>' do context 'absent' do + it 'is removed' do + pp = <<-EOS + apt_key { 'centos': + id => '#{CENTOS_GPG_KEY_ID}', + ensure => 'absent', + } + EOS + + # Install the key first + shell("apt-key adv --keyserver keyserver.ubuntu.com \ + --recv-keys #{CENTOS_GPG_KEY_ID}") + shell("apt-key list | grep #{CENTOS_GPG_KEY_ID}") + + # Time to remove it using Puppet + apply_manifest(pp, :catch_failures => true) + apply_manifest(pp, :catch_failures => true) + + shell("apt-key list | grep #{CENTOS_GPG_KEY_ID}", + :acceptable_exit_codes => [1]) + + shell("apt-key adv --keyserver keyserver.ubuntu.com \ + --recv-keys #{CENTOS_GPG_KEY_ID}") + end + end + + context 'absent, added with long key', :unless => (fact('operatingsystem') == 'Debian' and fact('operatingsystemmajrelease') == '6') do it 'is removed' do pp = <<-EOS apt_key { 'puppetlabs': -- 2.45.2