From b3cf65a24cc2cf9ddab21e77c5e49bdff7becf63 Mon Sep 17 00:00:00 2001 From: David Schmitt Date: Mon, 25 Sep 2017 10:16:17 +0100 Subject: [PATCH] Pull line.strip into key_list_lines --- lib/puppet/provider/apt_key2/apt_key2.rb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/puppet/provider/apt_key2/apt_key2.rb b/lib/puppet/provider/apt_key2/apt_key2.rb index 531fb83..8e145ae 100644 --- a/lib/puppet/provider/apt_key2/apt_key2.rb +++ b/lib/puppet/provider/apt_key2/apt_key2.rb @@ -24,7 +24,7 @@ class Puppet::Provider::AptKey2::AptKey2 if r[:name].length != 40 context.warning(r[:name], 'The name should be a full fingerprint (40 characters) to avoid collision attacks, see the README for details.') fingerprint = key_list_lines.select { |l| l.start_with?('fpr:') } - .map { |l| l.strip.split(':').last } + .map { |l| l.split(':').last } .find { |fp| fp.end_with? r[:name] } r[:name] = fingerprint if fingerprint end @@ -34,7 +34,7 @@ class Puppet::Provider::AptKey2::AptKey2 end def key_list_lines - `apt-key adv --list-keys --with-colons --fingerprint --fixed-list-mode 2>/dev/null`.each_line + `apt-key adv --list-keys --with-colons --fingerprint --fixed-list-mode 2>/dev/null`.each_line.map(&:strip) end def get(_context) @@ -49,7 +49,6 @@ class Puppet::Provider::AptKey2::AptKey2 # ) # lines = result.stdout key_list_lines.map { |line| - line = line.strip if line.start_with?('pub') pub_line = line elsif line.start_with?('fpr') -- 2.45.2