You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Variable f (in the finally clause) is not defined if file opening failed in /plugins/cache/jsonfile.py, line 94:
93 try:
94 f = codecs.open(cachefile, 'w', encoding='utf-8')
95 except (OSError,IOError) as e:
96 display.warning("error while trying to write to %s : %s" % (cachefile, to_bytes(e)))
97 pass
98 else:
99 f.write(jsonify(value))
100 finally:
101 f.close()
Which sometimes results in the following exception (thus hiding the original exception):
Traceback (most recent call last):
File "/usr/bin/ansible-playbook", line 86, in <module>
sys.exit(cli.run())
File "/usr/lib/python2.6/site-packages/ansible/cli/playbook.py", line 150, in run
results = pbex.run()
File "/usr/lib/python2.6/site-packages/ansible/executor/playbook_executor.py", line 140, in run
result = self._tqm.run(play=play)
File "/usr/lib/python2.6/site-packages/ansible/executor/task_queue_manager.py", line 238, in run
play_return = strategy.run(iterator, play_context)
File "/usr/lib/python2.6/site-packages/ansible/plugins/strategy/linear.py", line 268, in run
results += self._wait_on_pending_results(iterator)
File "/usr/lib/python2.6/site-packages/ansible/plugins/strategy/__init__.py", line 354, in _wait_on_pending_results
results = self._process_pending_results(iterator)
File "/usr/lib/python2.6/site-packages/ansible/plugins/strategy/__init__.py", line 331, in _process_pending_results
self._variable_manager.set_host_facts(target_host, facts)
File "/usr/lib/python2.6/site-packages/ansible/vars/__init__.py", line 580, in set_host_facts
self._fact_cache.update(host.name, facts)
File "/usr/lib/python2.6/site-packages/ansible/plugins/cache/__init__.py", line 77, in update
self._plugin.set(key, host_cache)
File "/usr/lib/python2.6/site-packages/ansible/plugins/cache/jsonfile.py", line 101, in set
f.close()
UnboundLocalError: local variable 'f' referenced before assignment
I guess, there's no need to close if we failed to open...
This is line 104 in the current version
The text was updated successfully, but these errors were encountered:
ISSUE TYPE
ANSIBLE VERSION
Variable f (in the finally clause) is not defined if file opening failed in /plugins/cache/jsonfile.py, line 94:
Which sometimes results in the following exception (thus hiding the original exception):
I guess, there's no need to close if we failed to open...
This is line 104 in the current version
The text was updated successfully, but these errors were encountered: