lib/framework/parsers/query_parser.rb in facter-4.0.25 vs lib/framework/parsers/query_parser.rb in facter-4.0.26

- old
+ new

@@ -48,10 +48,12 @@ resolvable_fact_list = get_facts_matching_tokens(query_tokens, query_token_range, loaded_fact_hash) return resolvable_fact_list if resolvable_fact_list.any? end + resolvable_fact_list << SearchedFact.new(query, nil, [], query, :nil) if resolvable_fact_list.empty? + resolvable_fact_list end def get_facts_matching_tokens(query_tokens, query_token_range, loaded_fact_hash) @log.debug "Checking query tokens #{query_tokens[query_token_range].join('.')}" @@ -71,12 +73,14 @@ end def found_fact?(fact_name, query_fact) fact_with_wildcard = fact_name.include?('.*') && !query_fact.include?('.') + processed_equery_fact = query_fact.gsub('\\', '\\\\\\\\') + return false if fact_with_wildcard && !query_fact.match("^#{fact_name}$") - return false unless fact_with_wildcard || fact_name.match("^#{query_fact}($|\\.)") + return false unless fact_with_wildcard || fact_name.match("^#{processed_equery_fact}($|\\.)") true end def construct_loaded_fact(query_tokens, query_token_range, loaded_fact)