use file.replace instead of file.sed

This commit is contained in:
Paul Tonelli 2015-02-25 17:27:19 +01:00 committed by C. R. Oldham
parent 123daf3090
commit 362e8c5ce0

View File

@ -132,11 +132,11 @@ def set_locale(locale):
__salt__['file.append']('/etc/sysconfig/i18n', __salt__['file.append']('/etc/sysconfig/i18n',
'"\nLANG={0}"'.format(locale)) '"\nLANG={0}"'.format(locale))
else: else:
__salt__['file.sed']( __salt__['file.replace'](
'/etc/sysconfig/i18n', '^LANG=.*', 'LANG="{0}"'.format(locale) '/etc/sysconfig/i18n', '^LANG=.*', 'LANG="{0}"'.format(locale)
) )
elif 'Debian' in __grains__['os_family']: elif 'Debian' in __grains__['os_family']:
__salt__['file.sed']( __salt__['file.replace'](
'/etc/default/locale', '^LANG=.*', 'LANG="{0}"'.format(locale) '/etc/default/locale', '^LANG=.*', 'LANG="{0}"'.format(locale)
) )
if __salt__['cmd.retcode']('grep "^LANG=" /etc/default/locale') != 0: if __salt__['cmd.retcode']('grep "^LANG=" /etc/default/locale') != 0: