1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Optimizes using fnmatch only if needed

Skips fnmatch'ing if there is only a '*' in filter.
This commit is contained in:
Michel Blanc 2013-02-22 17:41:18 +01:00
parent 7c270078f4
commit 92c679142f

View file

@ -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