diff options
author | Ryan Harper <ryan.harper@canonical.com> | 2019-09-26 19:43:29 +0000 |
---|---|---|
committer | Server Team CI Bot <josh.powers+server-team-bot@canonical.com> | 2019-09-26 19:43:29 +0000 |
commit | 0948cdfbef2052cdf839f24d6a17d457aa9fd4d3 (patch) | |
tree | f706bf38676acdd7fb5bba588550e80a35089fcf /tests | |
parent | 66ef979a2d7b8003def1ee4d7a6b6a261b37e0ee (diff) | |
download | vyos-cloud-init-0948cdfbef2052cdf839f24d6a17d457aa9fd4d3.tar.gz vyos-cloud-init-0948cdfbef2052cdf839f24d6a17d457aa9fd4d3.zip |
sysconfig: use distro variant to check if available
The sysconfig renderer used the distro name directly which mean
some variants of distros were not considered supported. Fix this
by using util.system_info()['variant'] instead. Fix the list of
KNOWN_DISTROS value for redhat -> rhel.
LP: #1843584
Diffstat (limited to 'tests')
-rw-r--r-- | tests/unittests/test_net.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/unittests/test_net.py b/tests/unittests/test_net.py index e5789924..a093cf10 100644 --- a/tests/unittests/test_net.py +++ b/tests/unittests/test_net.py @@ -4158,6 +4158,24 @@ class TestNetRenderers(CiTestCase): m_distro.return_value = ('opensuse', None, None) self.assertEqual('sysconfig', renderers.select(priority=None)[0]) + @mock.patch("cloudinit.net.sysconfig.available_sysconfig") + @mock.patch("cloudinit.util.get_linux_distro") + def test_sysconfig_available_uses_variant_mapping(self, m_distro, m_avail): + m_avail.return_value = True + distro_values = [ + ('opensuse', '', ''), + ('opensuse-leap', '', ''), + ('opensuse-tumbleweed', '', ''), + ('sles', '', ''), + ('centos', '', ''), + ('fedora', '', ''), + ('redhat', '', ''), + ] + for (distro_name, distro_version, flavor) in distro_values: + m_distro.return_value = (distro_name, distro_version, flavor) + result = sysconfig.available() + self.assertTrue(result) + class TestGetInterfaces(CiTestCase): _data = {'bonds': ['bond1'], |