puphpet/puppet/modules/apt/lib/puppet/provider/apt_key/apt_key.rb
# The tempfile method needs to return the tempfile object to the caller, so
# that it doesn't get deleted by the GC immediately after it returns.  We
# want the caller to control when it goes out of scope.
The tempfile method needs to return the tempfile object to the caller, so
that it doesn't get deleted by the GC immediately after it returns.  We
want the caller to control when it goes out of scope.
The tempfile method needs to return the tempfile object to the caller so that it doesn ' t get deleted by the GC immediately after it returns . We want the caller to control when it goes out of scope .
def tempfile(content)
    file = Tempfile.new('apt_key')
    file.write content
    file.close
    if name.size == 40
      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
        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
        warning('/usr/bin/gpg cannot be found for verification of the id.')
      end
    end
    file
  end
def tempfile ( content ) file = Tempfile . new ( 'apt_key' ) file . write content file . close if name . size == 40 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 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 warning ( '/usr/bin/gpg cannot be found for verification of the id.' ) end end file end
The tempfile method needs to return the tempfile object to the caller, so
that it doesn't get deleted by the GC immediately after it returns.
The tempfile method needs to return the tempfile object to the caller so that it doesn ' t get deleted by the GC immediately after it returns .
#confirm that the fingerprint from the file, matches the long key that is in the manifest
content
<not_specific>