Code Review
/
puppet-modules
/
puppetlabs-apt.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Merge pull request #318 from daenney/unicode-fix
[puppet-modules/puppetlabs-apt.git]
/
lib
/
puppet
/
provider
/
apt_key
/
apt_key.rb
diff --git
a/lib/puppet/provider/apt_key/apt_key.rb
b/lib/puppet/provider/apt_key/apt_key.rb
index 51791d024811444e18cde8abab1efc79b3904beb..1d3c1744b586ccd5ee0d2fb0e3eed29007a986ad 100644
(file)
--- a/
lib/puppet/provider/apt_key/apt_key.rb
+++ b/
lib/puppet/provider/apt_key/apt_key.rb
@@
-6,7
+6,8
@@
require 'tempfile'
if RUBY_VERSION == '1.8.7'
# Mothers cry, puppies die and Ruby 1.8.7's open-uri needs to be
# monkeypatched to support passing in :ftp_passive_mode.
if RUBY_VERSION == '1.8.7'
# Mothers cry, puppies die and Ruby 1.8.7's open-uri needs to be
# monkeypatched to support passing in :ftp_passive_mode.
- require 'puppet_x/apt_key/patch_openuri'
+ require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', '..',
+ 'puppet_x', 'apt_key', 'patch_openuri.rb'))
OpenURI::Options.merge!({:ftp_active_mode => false,})
end
OpenURI::Options.merge!({:ftp_active_mode => false,})
end
@@
-25,6
+26,11
@@
Puppet::Type.type(:apt_key).provide(:apt_key) do
commands :apt_key => 'apt-key'
def self.instances
commands :apt_key => 'apt-key'
def self.instances
+ if RUBY_VERSION > '1.8.7'
+ key_output = apt_key('list').encode('UTF-8', 'binary', :invalid => :replace, :undef => :replace, :replace => '')
+ else
+ key_output = apt_key('list')
+ end
key_array = apt_key('list').split("\n").collect do |line|
line_hash = key_line_hash(line)
next unless line_hash
key_array = apt_key('list').split("\n").collect do |line|
line_hash = key_line_hash(line)
next unless line_hash