diff options
author | Brett Holman <brett.holman@canonical.com> | 2022-07-13 13:05:46 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-13 14:05:46 -0500 |
commit | 9cbd94dd57112083856ead0e0ff724e9d1c1f714 (patch) | |
tree | 765e2001636bc233b775fb949699121ffdbaec6e /cloudinit/cmd | |
parent | b1a1a59a36a2580b2ebcb12e16c1411773548e3a (diff) | |
download | cloud-init-git-9cbd94dd57112083856ead0e0ff724e9d1c1f714.tar.gz |
Resource leak cleanup (#1556)
Add tox target for tracing for resource leaks, fix some leaks
Diffstat (limited to 'cloudinit/cmd')
-rwxr-xr-x | cloudinit/cmd/cloud_id.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/cloudinit/cmd/cloud_id.py b/cloudinit/cmd/cloud_id.py index 34160f8c..567d341a 100755 --- a/cloudinit/cmd/cloud_id.py +++ b/cloudinit/cmd/cloud_id.py @@ -76,7 +76,8 @@ def handle_args(name, args): return 3 try: - instance_data = json.load(open(args.instance_data)) + with open(args.instance_data) as file: + instance_data = json.load(file) except IOError: return error( "File not found '%s'. Provide a path to instance data json file" |