Merge pull request #23368 from kaithar/bp-23367

Backport #23367 to 2014.7
This commit is contained in:
Justin Findlay 2015-05-05 15:42:26 -06:00
commit 0c76dd4d8a

View file

@ -40,8 +40,10 @@ def _add_var(var, value):
fullvar = '{0}="{1}"'.format(var, value)
if __salt__['file.contains'](makeconf, layman):
# TODO perhaps make this a function in the file module?
cmd = ['sed', '-i', '/{0}/'.format(layman.replace('/', '\\/')),
fullvar, makeconf]
cmd = ['sed', '-i', r'/{0}/ i\{1}'.format(
layman.replace('/', '\\/'),
fullvar),
makeconf]
__salt__['cmd.run'](cmd)
else:
__salt__['file.append'](makeconf, fullvar)