summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2020-10-28 09:52:46 -0700
committerGitHub <noreply@github.com>2020-10-28 09:52:46 -0700
commit131e72dbb3dc03dc54decf73eb867c98714b7ef7 (patch)
tree97beedd577bb3c0cdd7b75f58a7a8cc811dcd6bd
parent1c1179fc345b92a2d8c4c5f95be2406b07e43229 (diff)
parent5b54538e22189fea3ba05539fde67a60638194d0 (diff)
downloadchef-131e72dbb3dc03dc54decf73eb867c98714b7ef7.tar.gz
Merge pull request #10560 from chef/simplify
Simplify a weird conditional in chef-config
-rw-r--r--chef-config/lib/chef-config/mixin/fuzzy_hostname_matcher.rb10
1 files changed, 9 insertions, 1 deletions
diff --git a/chef-config/lib/chef-config/mixin/fuzzy_hostname_matcher.rb b/chef-config/lib/chef-config/mixin/fuzzy_hostname_matcher.rb
index ab51966077..533db85860 100644
--- a/chef-config/lib/chef-config/mixin/fuzzy_hostname_matcher.rb
+++ b/chef-config/lib/chef-config/mixin/fuzzy_hostname_matcher.rb
@@ -20,8 +20,16 @@ module ChefConfig
module Mixin
module FuzzyHostnameMatcher
+ #
+ # Check to see if a hostname matches a match string. Used to see if hosts fall under our no_proxy config
+ #
+ # @param [String] hostname the hostname to check
+ # @param [String] matches the pattern to match
+ #
+ # @return [Boolean]
+ #
def fuzzy_hostname_match_any?(hostname, matches)
- if (!hostname.nil?) && (!matches.nil?)
+ if hostname && matches
return matches.to_s.split(/\s*,\s*/).compact.any? do |m|
fuzzy_hostname_match?(hostname, m)
end