lib/facter/framework/parsers/query_parser.rb in facter-4.2.2 vs lib/facter/framework/parsers/query_parser.rb in facter-4.2.3
- old
+ new
@@ -22,17 +22,15 @@
# loaded_fact - is a list with all facts for the current operating system
#
# Returns a list of SearchedFact objects that resolve the users query.
def parse(query_list, loaded_fact)
matched_facts = []
- @log.debug "User query is: #{query_list}"
@query_list = query_list
return no_user_query(loaded_fact) unless query_list.any?
query_list.each do |query|
- @log.debug "Query is #{query}"
found_facts = search_for_facts(query, loaded_fact)
matched_facts << found_facts
end
matched_facts.flatten(1)
@@ -63,11 +61,10 @@
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('.')}"
resolvable_fact_list = []
loaded_fact_hash.each do |loaded_fact|
query_fact = query_tokens[query_token_range].join('.')
@@ -75,10 +72,10 @@
searched_fact = construct_loaded_fact(query_tokens, loaded_fact)
resolvable_fact_list << searched_fact
end
- @log.debug "List of resolvable facts: #{resolvable_fact_list.inspect}"
+ @log.debug "List of resolvable facts: #{resolvable_fact_list.inspect}" if resolvable_fact_list.any?
resolvable_fact_list
end
def found_fact?(fact_name, query_fact)
fact_with_wildcard = fact_name.include?('.*') && !query_fact.include?('.')