diff options
author | Tim Smith <tsmith@chef.io> | 2020-10-28 09:52:46 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-28 09:52:46 -0700 |
commit | 131e72dbb3dc03dc54decf73eb867c98714b7ef7 (patch) | |
tree | 97beedd577bb3c0cdd7b75f58a7a8cc811dcd6bd | |
parent | 1c1179fc345b92a2d8c4c5f95be2406b07e43229 (diff) | |
parent | 5b54538e22189fea3ba05539fde67a60638194d0 (diff) | |
download | chef-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.rb | 10 |
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 |