diff --git a/library/setup b/library/setup index 3b82de4d239..4dddd4384a1 100644 --- a/library/setup +++ b/library/setup @@ -1105,9 +1105,9 @@ def run_setup(module): filtr = module.params['filter'] for (k, v) in facts.items(): - k = "ansible_%s" % k.replace('-', '_') - if fnmatch.fnmatch(k, module.params['filter']): - setup_options[k] = v + k2 = "ansible_%s" % k.replace('-', '_') + if fnmatch.fnmatch(k2, filtr): + setup_options[k2] = v # if facter is installed, and we can use --json because # ruby-json is ALSO installed, include facter data in the JSON @@ -1121,9 +1121,9 @@ def run_setup(module): facter = False if facter: for (k,v) in facter_ds.items(): - k = "facter_%s" % k - if fnmatch.fnmatch(k, module.params['filter']): - setup_options[k] = v + k2 = "facter_%s" % k + if fnmatch.fnmatch(k2, filtr): + setup_options[k2] = v # ditto for ohai, but just top level string keys # because it contains a lot of nested stuff we can't use for @@ -1140,7 +1140,7 @@ def run_setup(module): for (k,v) in ohai_ds.items(): if type(v) == str or type(v) == unicode: k2 = "ohai_%s" % k.replace('-', '_') - if fnmatch.fnmatch(k2, module.params['filter']): + if fnmatch.fnmatch(k2, filtr): setup_options[k2] = v setup_result = {}