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

Fixes unused var and avoid reassigning keys

Changed code so key doesn't get reassigned in loop
Made use of filtr variable
This commit is contained in:
Michel Blanc 2013-02-20 19:12:01 +01:00
parent 139e06d9af
commit 627577ecc9

View file

@ -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 = {}