module ChefConfig::Mixin::FuzzyHostnameMatcher
def fuzzy_hostname_match?(hostname, match)
def fuzzy_hostname_match?(hostname, match) # Do greedy matching by adding wildcard if it is not specified match = "*" + match unless match.start_with?("*") Fuzzyurl.matches?(Fuzzyurl.mask(hostname: match), hostname) end
def fuzzy_hostname_match_any?(hostname, matches)
-
(Boolean)
-
Parameters:
-
matches
(String
) -- the pattern to match -
hostname
(String
) -- the hostname to check
def fuzzy_hostname_match_any?(hostname, matches) if hostname && matches return matches.to_s.split(/\s*,\s*/).compact.any? do |m| fuzzy_hostname_match?(hostname, m) end end false end