From 2099a56b545769dd6d65a074e1c7d36dbd678822 Mon Sep 17 00:00:00 2001 From: Sergey Cherevko Date: Fri, 31 Mar 2023 11:26:17 +0300 Subject: [PATCH] Add MSVSphere support --- azurelinuxagent/common/osutil/factory.py | 2 +- azurelinuxagent/pa/rdma/factory.py | 2 +- tests/common/osutil/test_factory.py | 7 +++++++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/azurelinuxagent/common/osutil/factory.py b/azurelinuxagent/common/osutil/factory.py index b8f4291..8b71d29 100644 --- a/azurelinuxagent/common/osutil/factory.py +++ b/azurelinuxagent/common/osutil/factory.py @@ -102,7 +102,7 @@ def _get_osutil(distro_name, distro_code_name, distro_version, distro_full_name) return DebianOSBaseUtil() - if distro_name in ("redhat", "rhel", "centos", "oracle", "almalinux", "cloudlinux"): + if distro_name in ("redhat", "rhel", "centos", "oracle", "almalinux", "cloudlinux", "msvsphere"): if Version(distro_version) < Version("7"): return Redhat6xOSUtil() diff --git a/azurelinuxagent/pa/rdma/factory.py b/azurelinuxagent/pa/rdma/factory.py index 8fb5066..7990c49 100644 --- a/azurelinuxagent/pa/rdma/factory.py +++ b/azurelinuxagent/pa/rdma/factory.py @@ -38,7 +38,7 @@ def get_rdma_handler( ): return SUSERDMAHandler() - if distro_full_name in ('CentOS Linux', 'CentOS', 'Red Hat Enterprise Linux Server', 'AlmaLinux', 'CloudLinux'): + if distro_full_name in ('CentOS Linux', 'CentOS', 'Red Hat Enterprise Linux Server', 'AlmaLinux', 'CloudLinux', 'MSVSphere'): return CentOSRDMAHandler(distro_version) if distro_full_name == 'Ubuntu': diff --git a/tests/common/osutil/test_factory.py b/tests/common/osutil/test_factory.py index 9a76eb8..aee20a1 100644 --- a/tests/common/osutil/test_factory.py +++ b/tests/common/osutil/test_factory.py @@ -258,6 +258,13 @@ class TestOsUtilFactory(AgentTestCase): self.assertTrue(isinstance(ret, RedhatOSUtil)) self.assertEqual(ret.get_service_name(), "waagent") + ret = _get_osutil(distro_name="msvsphere", + distro_code_name="", + distro_full_name="", + distro_version="9") + self.assertTrue(isinstance(ret, RedhatOSUtil)) + self.assertEqual(ret.get_service_name(), "waagent") + def test_get_osutil_it_should_return_euleros(self): ret = _get_osutil(distro_name="euleros", distro_code_name="", -- 2.39.2