summaryrefslogtreecommitdiff
path: root/tests/unittests/test_handler
diff options
context:
space:
mode:
authorRobert Schweikert <rjschwei@suse.com>2017-08-25 11:13:58 -0400
committerScott Moser <smoser@brickies.net>2017-08-30 13:39:47 -0400
commitcbda576a7bbf846710ad55940bf8ca1f2d2194b9 (patch)
tree3d9eb6e4957735605cc294743f6b709cd44c42a7 /tests/unittests/test_handler
parent44529c1de0098ccd684b46b0bc18d48312c4097c (diff)
downloadvyos-cloud-init-cbda576a7bbf846710ad55940bf8ca1f2d2194b9.tar.gz
vyos-cloud-init-cbda576a7bbf846710ad55940bf8ca1f2d2194b9.zip
suse: Add support for openSUSE and return SLES to a working state.
This gets initial opensuse and SLES support back to a working state. Still missing is more complete network file writing and unit tests.
Diffstat (limited to 'tests/unittests/test_handler')
-rw-r--r--tests/unittests/test_handler/test_handler_locale.py12
-rw-r--r--tests/unittests/test_handler/test_handler_set_hostname.py5
2 files changed, 12 insertions, 5 deletions
diff --git a/tests/unittests/test_handler/test_handler_locale.py b/tests/unittests/test_handler/test_handler_locale.py
index e9a810c5..aaf6c762 100644
--- a/tests/unittests/test_handler/test_handler_locale.py
+++ b/tests/unittests/test_handler/test_handler_locale.py
@@ -49,9 +49,15 @@ class TestLocale(t_help.FilesystemMockingTestCase):
}
cc = self._get_cloud('sles')
cc_locale.handle('cc_locale', cfg, cc, LOG, [])
-
- contents = util.load_file('/etc/sysconfig/language', decode=False)
+ if cc.distro.uses_systemd:
+ locale_conf = cc.distro.systemd_locale_conf_fn
+ else:
+ locale_conf = cc.distro.locale_conf_fn
+ contents = util.load_file(locale_conf, decode=False)
n_cfg = ConfigObj(BytesIO(contents))
- self.assertEqual({'RC_LANG': cfg['locale']}, dict(n_cfg))
+ if cc.distro.uses_systemd():
+ self.assertEqual({'LANG': cfg['locale']}, dict(n_cfg))
+ else:
+ self.assertEqual({'RC_LANG': cfg['locale']}, dict(n_cfg))
# vi: ts=4 expandtab
diff --git a/tests/unittests/test_handler/test_handler_set_hostname.py b/tests/unittests/test_handler/test_handler_set_hostname.py
index 4b18de75..8165bf9a 100644
--- a/tests/unittests/test_handler/test_handler_set_hostname.py
+++ b/tests/unittests/test_handler/test_handler_set_hostname.py
@@ -70,7 +70,8 @@ class TestHostname(t_help.FilesystemMockingTestCase):
cc = cloud.Cloud(ds, paths, {}, distro, None)
self.patchUtils(self.tmp)
cc_set_hostname.handle('cc_set_hostname', cfg, cc, LOG, [])
- contents = util.load_file("/etc/HOSTNAME")
- self.assertEqual('blah', contents.strip())
+ if not distro.uses_systemd():
+ contents = util.load_file(distro.hostname_conf_fn)
+ self.assertEqual('blah', contents.strip())
# vi: ts=4 expandtab