Merge pull request #50340 from garethgreenaway/backport_48087_to_2018_3

[2018.3] Backporting #48087 to 2018.3
This commit is contained in:
Nicole Thomas 2018-11-01 14:15:36 -04:00 committed by GitHub
commit 12de4b99d4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

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)