Iterate through multiple keys
[puppet-modules/puppetlabs-apt.git] / lib / puppet / provider / apt_key / apt_key.rb
index bac5b373e937a2a366912e18eceb249e271485e4..f8c7d1976afb78b867e93148ca3e759f867bdb18 100644 (file)
@@ -141,7 +141,14 @@ Puppet::Type.type(:apt_key).provide(:apt_key) do
       if File.executable? command(:gpg)
         extracted_key = execute(["#{command(:gpg)} --with-fingerprint --with-colons #{file.path} | awk -F: '/^fpr:/ { print $10 }'"], :failonfail => false)
         extracted_key = extracted_key.chomp
-        if extracted_key != name
+
+        found_match = false
+        extracted_key.each_line do |line|
+          if line.chomp == name
+            found_match = true
+          end
+        end
+        if not found_match
           fail("The id in your manifest #{resource[:name]} and the fingerprint from content/source do not match. Please check there is not an error in the id or check the content/source is legitimate.")
         end
       else