closed fp after writing to temp files

pull/658/head
Steven Robertson 5 years ago
parent 3e6e99eeb7
commit 9eedff97a6

@ -94,7 +94,8 @@
from ansible.module_utils.basic import get_module_path from ansible.module_utils.basic import get_module_path
path = get_module_path() + '/foo.txt' path = get_module_path() + '/foo.txt'
result['path'] = path result['path'] = path
open(path, 'w').write("bar") with open(path, 'w') as f:
f.write("bar")
register: out register: out
- name: "Verify junk disappeared." - name: "Verify junk disappeared."
@ -136,7 +137,8 @@
from ansible.module_utils.basic import get_module_path from ansible.module_utils.basic import get_module_path
path = get_module_path() + '/foo.txt' path = get_module_path() + '/foo.txt'
result['path'] = path result['path'] = path
open(path, 'w').write("bar") with open(path, 'w') as f:
f.write("bar")
register: tmp_path register: tmp_path
# #

Loading…
Cancel
Save