From f97e43e9cf707f985f48259a657d4fe8e7e8705d Mon Sep 17 00:00:00 2001 From: mahailiang Date: Mon, 22 Aug 2022 11:32:06 +0800 Subject: [PATCH] add anolis support --- azurelinuxagent/common/osutil/factory.py | 3 +++ azurelinuxagent/common/version.py | 3 +++ tests/common/osutil/test_factory.py | 7 +++++++ 3 files changed, 13 insertions(+) diff --git a/azurelinuxagent/common/osutil/factory.py b/azurelinuxagent/common/osutil/factory.py index d48c493477..a6b02c223a 100644 --- a/azurelinuxagent/common/osutil/factory.py +++ b/azurelinuxagent/common/osutil/factory.py @@ -129,6 +129,9 @@ def _get_osutil(distro_name, distro_code_name, distro_version, distro_full_name) if distro_name == "uos": return RedhatOSUtil() + if distro_name == "anolis": + return RedhatOSUtil() + if distro_name == "freebsd": return FreeBSDOSUtil() diff --git a/azurelinuxagent/common/version.py b/azurelinuxagent/common/version.py index ff9c903b93..428d80512f 100644 --- a/azurelinuxagent/common/version.py +++ b/azurelinuxagent/common/version.py @@ -134,6 +134,9 @@ def get_distro(): if os.path.exists("/etc/UnionTech-release"): osinfo[0] = "uos" + if os.path.exists("/etc/anolis-release"): + osinfo[0] = "anolis" + if os.path.exists("/etc/mariner-release"): osinfo[0] = "mariner" diff --git a/tests/common/osutil/test_factory.py b/tests/common/osutil/test_factory.py index 7bd729c3b3..3a1e09bdc4 100644 --- a/tests/common/osutil/test_factory.py +++ b/tests/common/osutil/test_factory.py @@ -290,6 +290,13 @@ def test_get_osutil_it_should_return_uos(self): self.assertTrue(isinstance(ret, RedhatOSUtil)) self.assertEqual(ret.get_service_name(), "waagent") + def test_get_osutil_it_should_return_anolis(self): + ret = _get_osutil(distro_name="anolis", + distro_code_name="", + distro_version="", + distro_full_name="") + self.assertTrue(isinstance(ret, RedhatOSUtil)) + self.assertEqual(ret.get_service_name(), "waagent") def test_get_osutil_it_should_return_freebsd(self): ret = _get_osutil(distro_name="freebsd",