diff options
author | Alan Rominger <arominge@redhat.com> | 2021-06-25 20:17:51 +0200 |
---|---|---|
committer | Alan Rominger <arominge@redhat.com> | 2021-06-25 20:47:44 +0200 |
commit | 02cccbe608bdc9afe774ba7fdd138f7095d3e185 (patch) | |
tree | c743fe16746ef578b913289c03cff0699950fdc6 /awxkit | |
parent | Merge pull request #10490 from shanemcd/downstream-fixes (diff) | |
download | awx-02cccbe608bdc9afe774ba7fdd138f7095d3e185.tar.xz awx-02cccbe608bdc9afe774ba7fdd138f7095d3e185.zip |
Close file before returning
Diffstat (limited to 'awxkit')
-rw-r--r-- | awxkit/awxkit/yaml_file.py | 6 |
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) |