mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 09:23:56 +00:00
Switch open()
for salt.utils.fopen()
This commit is contained in:
parent
733b31da23
commit
0c9da726f5
@ -3872,9 +3872,11 @@ def serialize(name,
|
||||
if merge_if_exists:
|
||||
if os.path.isfile(name):
|
||||
if formatter == 'yaml':
|
||||
existing_data = yaml.safe_load(open(name, 'r'))
|
||||
with salt.utils.fopen(name, 'r') as fhr:
|
||||
existing_data = yaml.safe_load(fhr.read())
|
||||
elif formatter == 'json':
|
||||
existing_data = json.load(open(name, 'r'))
|
||||
with salt.utils.fopen(name, 'r') as fhr:
|
||||
existing_data = json.load(fhr.read())
|
||||
else:
|
||||
return {'changes': {},
|
||||
'comment': ('{0} format is not supported for merging'
|
||||
|
Loading…
Reference in New Issue
Block a user