You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
WALinuxAgent/SOURCES/0001-Add-MSVSphere-support....

84 lines
3.8 KiB

From 152c3669cbc1b87bba2984508e822a429134bcea Mon Sep 17 00:00:00 2001
From: Sergey Cherevko <sergey.cherevko@softline.com>
Date: Wed, 25 Dec 2024 16:33:05 +0300
Subject: [PATCH] Add MSVSphere support
---
azurelinuxagent/common/osutil/factory.py | 2 +-
azurelinuxagent/pa/rdma/factory.py | 2 +-
setup.py | 6 +++---
tests/common/osutil/test_factory.py | 7 +++++++
4 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/azurelinuxagent/common/osutil/factory.py b/azurelinuxagent/common/osutil/factory.py
index 83123e3..fba8398 100644
--- a/azurelinuxagent/common/osutil/factory.py
+++ b/azurelinuxagent/common/osutil/factory.py
@@ -115,7 +115,7 @@ def _get_osutil(distro_name, distro_code_name, distro_version, distro_full_name)
if distro_name in ("redhat", "rhel", "centos", "oracle", "almalinux",
- "cloudlinux", "rocky"):
+ "cloudlinux", "rocky", "msvsphere"):
if Version(distro_version) < Version("7"):
return Redhat6xOSUtil()
diff --git a/azurelinuxagent/pa/rdma/factory.py b/azurelinuxagent/pa/rdma/factory.py
index c114dc3..7495bd7 100644
--- a/azurelinuxagent/pa/rdma/factory.py
+++ b/azurelinuxagent/pa/rdma/factory.py
@@ -40,7 +40,7 @@ def get_rdma_handler(
if distro_full_name in ('CentOS Linux', 'CentOS',
'Red Hat Enterprise Linux Server', 'AlmaLinux',
- 'CloudLinux', 'Rocky Linux'):
+ 'CloudLinux', 'Rocky Linux', 'MSVSphere'):
return CentOSRDMAHandler(distro_version)
if distro_full_name == 'Ubuntu':
diff --git a/setup.py b/setup.py
index 8f5d92b..94facdc 100755
--- a/setup.py
+++ b/setup.py
@@ -96,8 +96,8 @@ def get_data_files(name, version, fullname): # pylint: disable=R0912
systemd_dir_path = osutil.get_systemd_unit_file_install_path()
agent_bin_path = osutil.get_agent_bin_path()
- if name in ('redhat', 'rhel', 'centos', 'almalinux', 'cloudlinux', 'rocky'):
- if version.startswith("8") or version.startswith("9"):
+ if name in ('redhat', 'rhel', 'centos', 'almalinux', 'cloudlinux', 'rocky', 'msvsphere'):
+ if version.startswith("8") or version.startswith("9") or version.startswith("10"):
# redhat8+ default to py3
set_bin_files(data_files, dest=agent_bin_path,
src=["bin/py3/waagent", "bin/waagent2.0"])
@@ -106,7 +106,7 @@ def get_data_files(name, version, fullname): # pylint: disable=R0912
set_conf_files(data_files)
set_logrotate_files(data_files)
set_udev_files(data_files)
- if version.startswith("8") or version.startswith("9"):
+ if version.startswith("8") or version.startswith("9") or version.startswith("10"):
# redhat 8+ uses systemd and python3
set_systemd_files(data_files, dest=systemd_dir_path,
src=["init/redhat/waagent.service",
diff --git a/tests/common/osutil/test_factory.py b/tests/common/osutil/test_factory.py
index 7bd729c..3c6339b 100644
--- a/tests/common/osutil/test_factory.py
+++ b/tests/common/osutil/test_factory.py
@@ -55,6 +55,13 @@ class TestOsUtilFactory(AgentTestCase):
self.assertEqual(patch_logger.call_count, 1)
self.assertEqual(ret.get_service_name(), "waagent")
+ ret = _get_osutil(distro_name="msvsphere",
+ distro_code_name="",
+ distro_full_name="",
+ distro_version="10")
+ self.assertTrue(isinstance(ret, RedhatOSUtil))
+ self.assertEqual(ret.get_service_name(), "waagent")
+
def test_get_osutil_it_should_return_ubuntu(self):
ret = _get_osutil(distro_name="ubuntu",
distro_code_name="",
--
2.43.5