diff options
author | Abhijeet Kasurde <akasurde@redhat.com> | 2019-01-11 20:44:08 +0530 |
---|---|---|
committer | Brian Coca <bcoca@users.noreply.github.com> | 2019-01-11 10:14:08 -0500 |
commit | db8702cdb82c75f426146737aa20022fd081d4f0 (patch) | |
tree | 66b7a0c4f1f5b8810681ffc216601edd9d11dd27 /lib/ansible/executor | |
parent | 94a1d86d70f02c1c7fa55426a428e656566c1359 (diff) | |
download | ansible-db8702cdb82c75f426146737aa20022fd081d4f0.tar.gz |
Close all open filehandle (#50544)
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
Diffstat (limited to 'lib/ansible/executor')
-rw-r--r-- | lib/ansible/executor/module_common.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/ansible/executor/module_common.py b/lib/ansible/executor/module_common.py index bae447c7df..8402f21217 100644 --- a/lib/ansible/executor/module_common.py +++ b/lib/ansible/executor/module_common.py @@ -748,7 +748,8 @@ def _find_module_utils(module_name, b_module_data, module_path, module_args, tas # the write lock. Go ahead and read the data from disk # instead of re-creating it. try: - zipdata = open(cached_module_filename, 'rb').read() + with open(cached_module_filename, 'rb') as f: + zipdata = f.read() except IOError: raise AnsibleError('A different worker process failed to create module file. ' 'Look at traceback for that process for debugging information.') |