mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 08:58:59 +00:00
Update os_family grain to be "Suse" instead of "SUSE" for localemod
Also update some of the test functions to be a little more clear
This commit is contained in:
parent
9e9d5ad0a9
commit
3898117d6e
@ -132,7 +132,7 @@ def get_locale():
|
||||
return params.get('LANG', '')
|
||||
elif 'RedHat' in __grains__['os_family']:
|
||||
cmd = 'grep "^LANG=" /etc/sysconfig/i18n'
|
||||
elif 'SUSE' in __grains__['os_family']:
|
||||
elif 'Suse' in __grains__['os_family']:
|
||||
cmd = 'grep "^RC_LANG" /etc/sysconfig/language'
|
||||
elif 'Debian' in __grains__['os_family']:
|
||||
# this block only applies to Debian without systemd
|
||||
@ -172,7 +172,7 @@ def set_locale(locale):
|
||||
'LANG="{0}"'.format(locale),
|
||||
append_if_not_found=True
|
||||
)
|
||||
elif 'SUSE' in __grains__['os_family']:
|
||||
elif 'Suse' in __grains__['os_family']:
|
||||
if not __salt__['file.file_exists']('/etc/sysconfig/language'):
|
||||
__salt__['file.touch']('/etc/sysconfig/language')
|
||||
__salt__['file.replace'](
|
||||
@ -261,7 +261,7 @@ def gen_locale(locale, **kwargs):
|
||||
on_debian = __grains__.get('os') == 'Debian'
|
||||
on_ubuntu = __grains__.get('os') == 'Ubuntu'
|
||||
on_gentoo = __grains__.get('os_family') == 'Gentoo'
|
||||
on_suse = __grains__.get('os_family') == 'SUSE'
|
||||
on_suse = __grains__.get('os_family') == 'Suse'
|
||||
on_solaris = __grains__.get('os_family') == 'Solaris'
|
||||
|
||||
if on_solaris: # all locales are pre-generated
|
||||
|
@ -26,14 +26,15 @@ def _find_new_locale(current_locale):
|
||||
class LocaleModuleTest(ModuleCase):
|
||||
def test_get_locale(self):
|
||||
locale = self.run_function('locale.get_locale')
|
||||
self.assertNotEqual(None, locale)
|
||||
self.assertNotIn('Unsupported platform!', locale)
|
||||
self.assertNotEqual('', locale)
|
||||
|
||||
@destructiveTest
|
||||
def test_gen_locale(self):
|
||||
locale = self.run_function('locale.get_locale')
|
||||
new_locale = _find_new_locale(locale)
|
||||
ret = self.run_function('locale.gen_locale', [new_locale])
|
||||
self.assertEqual(True, ret)
|
||||
self.assertTrue(ret)
|
||||
|
||||
@destructiveTest
|
||||
def test_set_locale(self):
|
||||
@ -42,6 +43,6 @@ class LocaleModuleTest(ModuleCase):
|
||||
self.run_function('locale.gen_locale', [locale_to_set])
|
||||
ret = self.run_function('locale.set_locale', [locale_to_set])
|
||||
new_locale = self.run_function('locale.get_locale')
|
||||
self.assertEqual(True, ret)
|
||||
self.assertTrue(ret)
|
||||
self.assertEqual(locale_to_set, new_locale)
|
||||
self.run_function('locale.set_locale', [original_locale])
|
||||
|
Loading…
Reference in New Issue
Block a user