diff options
author | Kristian Klausen <kristian@klausen.dk> | 2021-03-15 20:30:03 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-15 14:30:03 -0500 |
commit | 3aeb14cd46613b97afefc4632909f6e9b83d0230 (patch) | |
tree | 591f52bf5800f63b3e9db00ce711e812b4d5f3cf /tests/unittests/test_handler/test_handler_locale.py | |
parent | d95b448fe106146b7510f7b64f2e83c51943f04d (diff) | |
download | vyos-cloud-init-3aeb14cd46613b97afefc4632909f6e9b83d0230.tar.gz vyos-cloud-init-3aeb14cd46613b97afefc4632909f6e9b83d0230.zip |
archlinux: Fix broken locale logic (#841)
The locale wasn't persisted correct nor set.
LP: #1402406
Diffstat (limited to 'tests/unittests/test_handler/test_handler_locale.py')
-rw-r--r-- | tests/unittests/test_handler/test_handler_locale.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/unittests/test_handler/test_handler_locale.py b/tests/unittests/test_handler/test_handler_locale.py index 47e7d804..15fe7b23 100644 --- a/tests/unittests/test_handler/test_handler_locale.py +++ b/tests/unittests/test_handler/test_handler_locale.py @@ -44,6 +44,29 @@ class TestLocale(t_help.FilesystemMockingTestCase): cc = cloud.Cloud(ds, paths, {}, d, None) return cc + def test_set_locale_arch(self): + locale = 'en_GB.UTF-8' + locale_configfile = '/etc/invalid-locale-path' + cfg = { + 'locale': locale, + 'locale_configfile': locale_configfile, + } + cc = self._get_cloud('arch') + + with mock.patch('cloudinit.distros.arch.subp.subp') as m_subp: + with mock.patch('cloudinit.distros.arch.LOG.warning') as m_LOG: + cc_locale.handle('cc_locale', cfg, cc, LOG, []) + m_LOG.assert_called_with('Invalid locale_configfile %s, ' + 'only supported value is ' + '/etc/locale.conf', + locale_configfile) + + contents = util.load_file(cc.distro.locale_gen_fn) + self.assertIn('%s UTF-8' % locale, contents) + m_subp.assert_called_with(['localectl', + 'set-locale', + locale], capture=False) + def test_set_locale_sles(self): cfg = { |