From 92c679142f62484b9cd1dd0427122026aa6f2a9f Mon Sep 17 00:00:00 2001 From: Michel Blanc Date: Fri, 22 Feb 2013 17:41:18 +0100 Subject: [PATCH] Optimizes using fnmatch only if needed Skips fnmatch'ing if there is only a '*' in filter. --- library/setup | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/setup b/library/setup index b6c67fb1723..5863eac7c59 100644 --- a/library/setup +++ b/library/setup @@ -1140,7 +1140,7 @@ def run_setup(module): setup_result = { 'ansible_facts': {} } 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 # hack to keep --verbose from showing all the setup module results