new(
:name => line_hash[:key_fingerprint],
- :id => line_hash[:key_fingerprint],
+ :id => line_hash[:key_long],
:fingerprint => line_hash[:key_fingerprint],
:short => line_hash[:key_short],
:long => line_hash[:key_long],
end
def destroy
- #Currently del only removes the first key, we need to recursively list and ensure all with id are absent.
- apt_key('del', resource[:id])
+ begin
+ apt_key('del', resource.provider.long)
+ r = execute(["#{command(:apt_key)} list | grep #{resource.provider.long}"], :failonfail => false)
+ end while r.exitstatus == 0
@property_hash.clear
end
CENTOS_REPO_URL = 'ftp.cvut.cz/centos'
CENTOS_GPG_KEY_FILE = 'RPM-GPG-KEY-CentOS-6'
+SHOULD_NEVER_EXIST_ID = '4BD6EC30'
+
KEY_CHECK_COMMAND = "apt-key adv --list-keys --with-colons --fingerprint | grep "
PUPPETLABS_KEY_CHECK_COMMAND = "#{KEY_CHECK_COMMAND} #{PUPPETLABS_GPG_KEY_FINGERPRINT}"
CENTOS_KEY_CHECK_COMMAND = "#{KEY_CHECK_COMMAND} #{CENTOS_GPG_KEY_FINGERPRINT}"
it 'fails with a 550' do
pp = <<-EOS
apt_key { 'CentOS 6':
- id => '#{CENTOS_GPG_KEY_LONG_ID}',
+ id => '#{SHOULD_NEVER_EXIST_ID}',
ensure => 'present',
source => 'ftp://#{CENTOS_REPO_URL}/herpderp.gpg',
}
it 'fails with a 404' do
pp = <<-EOS
apt_key { 'puppetlabs':
- id => '4BD6EC30',
+ id => '#{SHOULD_NEVER_EXIST_ID}',
ensure => 'present',
source => 'https://#{PUPPETLABS_APT_URL}/herpderp.gpg',
}
it 'fails with a socket error' do
pp = <<-EOS
apt_key { 'puppetlabs':
- id => '4BD6EC30',
+ id => '#{SHOULD_NEVER_EXIST_ID}',
ensure => 'present',
source => 'https://apt.puppetlabss.com/herpderp.gpg',
}