summaryrefslogtreecommitdiffstats
path: root/awxkit
diff options
context:
space:
mode:
authorAlan Rominger <arominge@redhat.com>2021-06-25 20:17:51 +0200
committerAlan Rominger <arominge@redhat.com>2021-06-25 20:47:44 +0200
commit02cccbe608bdc9afe774ba7fdd138f7095d3e185 (patch)
treec743fe16746ef578b913289c03cff0699950fdc6 /awxkit
parentMerge pull request #10490 from shanemcd/downstream-fixes (diff)
downloadawx-02cccbe608bdc9afe774ba7fdd138f7095d3e185.tar.xz
awx-02cccbe608bdc9afe774ba7fdd138f7095d3e185.zip
Close file before returning
Diffstat (limited to 'awxkit')
-rw-r--r--awxkit/awxkit/yaml_file.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/awxkit/awxkit/yaml_file.py b/awxkit/awxkit/yaml_file.py
index 49924cef93..7adbe142d7 100644
--- a/awxkit/awxkit/yaml_file.py
+++ b/awxkit/awxkit/yaml_file.py
@@ -89,9 +89,9 @@ def load_file(filename):
path = local(filename)
if path.check():
- fp = path.open()
- # FIXME - support load_all()
- return yaml.load(fp, Loader=Loader)
+ with open(path, 'r') as fp:
+ # FIXME - support load_all()
+ return yaml.load(fp, Loader=Loader)
else:
msg = 'Unable to load data file at %s' % path
raise Exception(msg)