Backporting #48087 to 2018.3

This commit is contained in:
Gareth J. Greenaway 2018-11-01 08:46:31 -07:00
parent af1075b26d
commit 56c87ff690
No known key found for this signature in database
GPG key ID: 10B62F8A7CAD7A41

View file

@ -165,7 +165,7 @@ def persist(name, value, config='/etc/sysctl.conf'):
if not edited:
nlines.append("{0}\n".format(_formatfor(name, value, config)))
with salt.utils.files.fopen(config, 'w+') as ofile:
nlines = [salt.utils.stringutils.to_str(_l) for _l in nlines]
nlines = [salt.utils.stringutils.to_str(_l) + '\n' for _l in nlines]
ofile.writelines(nlines)
if config != '/boot/loader.conf':
assign(name, value)