summaryrefslogtreecommitdiff
path: root/lib/chef
diff options
context:
space:
mode:
authorPete Higgins <pete@peterhiggins.org>2020-08-03 16:56:20 -0700
committerPete Higgins <pete@peterhiggins.org>2020-08-03 16:56:20 -0700
commit8bf86b11c041d4041988a4f12c40502ccef72611 (patch)
treef40fd6865a3ed39bad67dab998bcb2b9f0ef68e4 /lib/chef
parentc202ce4e318a6bc842158970aeb6b3d13fa6a0df (diff)
downloadchef-8bf86b11c041d4041988a4f12c40502ccef72611.tar.gz
Avoid unnecessary control flow.
Signed-off-by: Pete Higgins <pete@peterhiggins.org>
Diffstat (limited to 'lib/chef')
-rw-r--r--lib/chef/resource/apt_repository.rb11
1 files changed, 1 insertions, 10 deletions
diff --git a/lib/chef/resource/apt_repository.rb b/lib/chef/resource/apt_repository.rb
index 4ffd18cb3b..bc0c904745 100644
--- a/lib/chef/resource/apt_repository.rb
+++ b/lib/chef/resource/apt_repository.rb
@@ -192,16 +192,7 @@ class Chef
#
# @return [Boolean] is the key valid or not
def key_is_valid?(key)
- valid = true
-
- so = shell_out("apt-key", "list")
- so.stdout.split(/\n/).map do |t|
- if %r{^\/#{key}.*\[expired: .*\]$}.match?(t)
- logger.debug "Found expired key: #{t}"
- valid = false
- break
- end
- end
+ valid = shell_out("apt-key", "list").stdout.each_line.none?(%r{^\/#{key}.*\[expired: .*\]$})
logger.debug "key #{key} #{valid ? "is valid" : "is not valid"}"
valid