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:
parent
d7385263e3
commit
e7ff689fda
1 changed files with 7 additions and 7 deletions
14
setup
14
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 = {}
|
||||
|
|
Loading…
Reference in a new issue