mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 13:22:48 +00:00
made get_file_lines rely on get_file_content which deals with many error
conditions that the former did not.
This commit is contained in:
@@ -2982,12 +2982,13 @@ def get_file_content(path, default=None, strip=True):
|
||||
return data
|
||||
|
||||
def get_file_lines(path):
|
||||
'''file.readlines() that closes the file'''
|
||||
datafile = open(path)
|
||||
try:
|
||||
return datafile.readlines()
|
||||
finally:
|
||||
datafile.close()
|
||||
'''get list of lines from file'''
|
||||
data = get_file_content(path)
|
||||
if data:
|
||||
ret = data.splitlines()
|
||||
else:
|
||||
ret = []
|
||||
return ret
|
||||
|
||||
def ansible_facts(module):
|
||||
facts = {}
|
||||
|
||||
Reference in New Issue
Block a user