Commit 92c67914 by Michel Blanc

Optimizes using fnmatch only if needed

Skips fnmatch'ing if there is only a '*' in filter.
parent 7c270078
...@@ -1140,7 +1140,7 @@ def run_setup(module): ...@@ -1140,7 +1140,7 @@ def run_setup(module):
setup_result = { 'ansible_facts': {} } setup_result = { 'ansible_facts': {} }
for (k,v) in setup_options.items(): for (k,v) in setup_options.items():
if fnmatch.fnmatch(k, module.params['filter']): if module.params['filter'] == '*' or fnmatch.fnmatch(k, module.params['filter']):
setup_result['ansible_facts'][k] = v setup_result['ansible_facts'][k] = v
# hack to keep --verbose from showing all the setup module results # hack to keep --verbose from showing all the setup module results
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment