You should be able to create/delete keys using the long key to avoid
collisions, and truncating in the type makes that not work.
def self.prefetch(resources)
apt_keys = instances
resources.keys.each do |name|
def self.prefetch(resources)
apt_keys = instances
resources.keys.each do |name|
- if provider = apt_keys.find{ |key| key.name == name }
+ if name.length == 16
+ shortname=name[8..-1]
+ else
+ shortname=name
+ end
+ if provider = apt_keys.find{ |key| key.name == shortname }
resources[name].provider = provider
end
end
resources[name].provider = provider
end
end
else
id = value.upcase
end
else
id = value.upcase
end
- if id.length == 16
- id[8..-1]
- else
- id
- end
require 'spec_helper_acceptance'
require 'spec_helper_acceptance'
-PUPPETLABS_GPG_KEY_ID = '4BD6EC30'
-PUPPETLABS_APT_URL = 'apt.puppetlabs.com'
-PUPPETLABS_GPG_KEY_FILE = 'pubkey.gpg'
-CENTOS_GPG_KEY_ID = 'C105B9DE'
-CENTOS_REPO_URL = 'ftp.cvut.cz/centos'
-CENTOS_GPG_KEY_FILE = 'RPM-GPG-KEY-CentOS-6'
+PUPPETLABS_GPG_KEY_ID = '4BD6EC30'
+PUPPETLABS_GPG_LONG_KEY_ID = '1054B7A24BD6EC30'
+PUPPETLABS_APT_URL = 'apt.puppetlabs.com'
+PUPPETLABS_GPG_KEY_FILE = 'pubkey.gpg'
+CENTOS_GPG_KEY_ID = 'C105B9DE'
+CENTOS_REPO_URL = 'ftp.cvut.cz/centos'
+CENTOS_GPG_KEY_FILE = 'RPM-GPG-KEY-CentOS-6'
describe 'apt_key' do
before(:each) do
describe 'apt_key' do
before(:each) do
+ # Delete twice to make sure everything is cleaned
+ # up after the short key collision
+ shell("apt-key del #{PUPPETLABS_GPG_KEY_ID}",
+ :acceptable_exit_codes => [0,1,2])
shell("apt-key del #{PUPPETLABS_GPG_KEY_ID}",
:acceptable_exit_codes => [0,1,2])
end
shell("apt-key del #{PUPPETLABS_GPG_KEY_ID}",
:acceptable_exit_codes => [0,1,2])
end
EOS
apply_manifest(pp, :catch_failures => true)
EOS
apply_manifest(pp, :catch_failures => true)
- apply_manifest(pp, :catch_failures => true)
+ apply_manifest(pp, :catch_changes => true)
shell("apt-key list | grep #{PUPPETLABS_GPG_KEY_ID}")
end
end
shell("apt-key list | grep #{PUPPETLABS_GPG_KEY_ID}")
end
end
# Install the key first
shell("apt-key adv --keyserver keyserver.ubuntu.com \
# Install the key first
shell("apt-key adv --keyserver keyserver.ubuntu.com \
- --recv-keys #{PUPPETLABS_GPG_KEY_ID}")
+ --recv-keys #{PUPPETLABS_GPG_LONG_KEY_ID}")
shell("apt-key list | grep #{PUPPETLABS_GPG_KEY_ID}")
# Time to remove it using Puppet
shell("apt-key list | grep #{PUPPETLABS_GPG_KEY_ID}")
# Time to remove it using Puppet