diff options
author | Pete Higgins <pete@peterhiggins.org> | 2020-08-03 16:56:20 -0700 |
---|---|---|
committer | Pete Higgins <pete@peterhiggins.org> | 2020-08-03 16:56:20 -0700 |
commit | 8bf86b11c041d4041988a4f12c40502ccef72611 (patch) | |
tree | f40fd6865a3ed39bad67dab998bcb2b9f0ef68e4 /lib/chef | |
parent | c202ce4e318a6bc842158970aeb6b3d13fa6a0df (diff) | |
download | chef-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.rb | 11 |
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 |