summaryrefslogtreecommitdiff
path: root/lib/chef/provider
diff options
context:
space:
mode:
authorTom Duffield <tom@chef.io>2017-03-08 13:14:05 -0600
committerGitHub <noreply@github.com>2017-03-08 13:14:05 -0600
commit072c3a8144be7188fa117cca88d8c13c493feaa7 (patch)
treec308f71e2bf3129f5b390c470de1966ff77afb40 /lib/chef/provider
parent6e3c3bca71be0e46554af47c37fd2fa849464870 (diff)
parentd7ac39bb7a7f710726bfd1adcf32ea07e6cb711d (diff)
downloadchef-072c3a8144be7188fa117cca88d8c13c493feaa7.tar.gz
Merge pull request #5874 from chef/afiune/COOL-685/apt_repository_key_fingerprint_fix
Fix apt_repository for latest os version 16.10
Diffstat (limited to 'lib/chef/provider')
-rw-r--r--lib/chef/provider/apt_repository.rb8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/chef/provider/apt_repository.rb b/lib/chef/provider/apt_repository.rb
index 9e91b12373..07aeb090d0 100644
--- a/lib/chef/provider/apt_repository.rb
+++ b/lib/chef/provider/apt_repository.rb
@@ -115,7 +115,7 @@ class Chef
so = shell_out(cmd)
so.run_command
so.stdout.split(/\n/).map do |t|
- if z = t.match(/^ +Key fingerprint = ([0-9A-F ]+)/)
+ if z = t.match(/^fpr:+([0-9A-F]+):/)
z[1].split.join
end
end.compact
@@ -147,8 +147,10 @@ class Chef
end
def no_new_keys?(file)
- installed_keys = extract_fingerprints_from_cmd("apt-key finger")
- proposed_keys = extract_fingerprints_from_cmd("gpg --with-fingerprint #{file}")
+ # Now we are using the option --with-colons that works across old os versions
+ # as well as the latest (16.10). This for both `apt-key` and `gpg` commands
+ installed_keys = extract_fingerprints_from_cmd("apt-key adv --list-public-keys --with-fingerprint --with-colons")
+ proposed_keys = extract_fingerprints_from_cmd("gpg --with-fingerprint --with-colons #{file}")
(installed_keys & proposed_keys).sort == proposed_keys.sort
end