diff options
author | Clark Boylan <clark.boylan@gmail.com> | 2023-02-07 17:12:15 -0800 |
---|---|---|
committer | Clark Boylan <clark.boylan@gmail.com> | 2023-02-07 17:12:15 -0800 |
commit | ee3339c8e6d76562983ca0da117234eac434671e (patch) | |
tree | 65a415ad87a91588a48f570337bcc2f76fe8dc38 /zuul | |
parent | 2747ea6f56137bf675acb15614041c654375a7b5 (diff) | |
download | zuul-ee3339c8e6d76562983ca0da117234eac434671e.tar.gz |
Fix more file opening ResourceWarnings
I've managed to get better at grepping for this and this finds some of
the stragglers. They are all file opens without closes fixed by using a
with open() context manager.
Change-Id: I7b8c8516a86558e2027cb0f01aefe2dd1849069c
Diffstat (limited to 'zuul')
-rw-r--r-- | zuul/ansible/logconfig.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/zuul/ansible/logconfig.py b/zuul/ansible/logconfig.py index 66881336a..2d7c37463 100644 --- a/zuul/ansible/logconfig.py +++ b/zuul/ansible/logconfig.py @@ -140,7 +140,8 @@ def _read_config_file(filename: str): raise ValueError("Unable to read logging config file at %s" % filename) if os.path.splitext(filename)[1] in ('.yml', '.yaml', '.json'): - return yaml.safe_load(open(filename, 'r')) + with open(filename, 'r') as f: + return yaml.safe_load(f) return filename |