mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Use with guard for file reads.
This commit is contained in:
parent
deaf499ba1
commit
71afb9e432
1 changed files with 5 additions and 5 deletions
|
@ -33,7 +33,7 @@ class InventoryParser(object):
|
||||||
|
|
||||||
def __init__(self, filename=C.DEFAULT_HOST_LIST):
|
def __init__(self, filename=C.DEFAULT_HOST_LIST):
|
||||||
|
|
||||||
fh = open(filename)
|
with open(filename) as fh:
|
||||||
self.lines = fh.readlines()
|
self.lines = fh.readlines()
|
||||||
self.groups = {}
|
self.groups = {}
|
||||||
self.hosts = {}
|
self.hosts = {}
|
||||||
|
|
Loading…
Reference in a new issue