From 981add2561679b0c3ab5eb017a8f606444cf52c1 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. --- setup | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup b/setup index b6c67fb1723..5863eac7c59 100644 --- a/setup +++ b/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