Prevent Adding Key Every chef-client Run
In Debian 10, the previous apt-key command didn't work as expected.
MODIFY
recipes/repository.rb
recipes/repository.rb
@@ -67,7 +67,7 @@ when 'debian'
key_short = key[-8..-1] # last 8 chars, since some versions of apt-key add dashes between key sections
execute "apt-key import key #{key_short}" do
command "apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 #{key}"
- not_if "apt-key list | grep #{key_short}"
+ not_if "apt-key adv --list-public-keys --with-fingerprint --with-colons | grep #{key_short} | grep pub"
end
end

MODIFY
spec/spec_helper.rb
spec/spec_helper.rb
@@ -29,7 +29,7 @@ RSpec.configure do |config|
# recipes/repository.rb
stub_command('rpm -q gpg-pubkey-e09422b3').and_return(false)
stub_command('rpm -q gpg-pubkey-fd4bf915').and_return(false)
- stub_command('apt-key list | grep 382E94DE').and_return(false)
+ stub_command('apt-key adv --list-public-keys --with-fingerprint --with-colons | grep 382E94DE | grep pub').and_return(false)
end
Ohai::Config[:log_level] = :warn

Prevent Adding Key Every chef-client Run (#767)

In Debian 10, the previous apt-key command didn't work as expected.