From d1df06d88f74b391090f4771a4df84fae589809b Mon Sep 17 00:00:00 2001 From: Vitaly Kuznetsov Date: Tue, 26 Jan 2021 16:09:39 +0100 Subject: [PATCH] Fix distro resolution for RedHat Signed-off-by: Vitaly Kuznetsov --- ...ix-distro-resolution-for-RedHat-2083.patch | 64 +++++++++++++++++++ WALinuxAgent.spec | 9 ++- 2 files changed, 71 insertions(+), 2 deletions(-) create mode 100644 0004-Fix-distro-resolution-for-RedHat-2083.patch diff --git a/0004-Fix-distro-resolution-for-RedHat-2083.patch b/0004-Fix-distro-resolution-for-RedHat-2083.patch new file mode 100644 index 0000000..e0ce7b2 --- /dev/null +++ b/0004-Fix-distro-resolution-for-RedHat-2083.patch @@ -0,0 +1,64 @@ +From 3420fef144cf9a5be62cfae16f64c298ca397a17 Mon Sep 17 00:00:00 2001 +From: Paula Gombar +Date: Wed, 2 Dec 2020 21:36:41 -0800 +Subject: [PATCH] Fix distro resolution for RedHat (#2083) + +vkuznets: cherry-picking the primary change of the commit (adding 'rhel') +only, pylint changes require additional commits. + +Signed-off-by: Vitaly Kuznetsov +--- + azurelinuxagent/common/osutil/factory.py | 4 +--- + tests/common/osutil/test_factory.py | 14 ++++++++++++++ + 2 files changed, 15 insertions(+), 3 deletions(-) + +diff --git a/azurelinuxagent/common/osutil/factory.py b/azurelinuxagent/common/osutil/factory.py +index 69f8430052d5..caecaa0887e2 100644 +--- a/azurelinuxagent/common/osutil/factory.py ++++ b/azurelinuxagent/common/osutil/factory.py +@@ -97,9 +97,7 @@ def _get_osutil(distro_name, distro_code_name, distro_version, distro_full_name) + else: + return DebianOSBaseUtil() + +- if distro_name == "redhat" \ +- or distro_name == "centos" \ +- or distro_name == "oracle": ++ if distro_name in ("redhat", "rhel", "centos", "oracle"): + if Version(distro_version) < Version("7"): + return Redhat6xOSUtil() + else: +diff --git a/tests/common/osutil/test_factory.py b/tests/common/osutil/test_factory.py +index aa7daebcf25f..2ac0849f75c9 100644 +--- a/tests/common/osutil/test_factory.py ++++ b/tests/common/osutil/test_factory.py +@@ -188,6 +188,13 @@ class TestOsUtilFactory(AgentTestCase): + self.assertTrue(type(ret) == Redhat6xOSUtil) + self.assertEquals(ret.get_service_name(), "waagent") + ++ ret = _get_osutil(distro_name="rhel", ++ distro_code_name="", ++ distro_full_name="", ++ distro_version="6") ++ self.assertTrue(type(ret) == Redhat6xOSUtil) ++ self.assertEquals(ret.get_service_name(), "waagent") ++ + ret = _get_osutil(distro_name="centos", + distro_code_name="", + distro_full_name="", +@@ -209,6 +216,13 @@ class TestOsUtilFactory(AgentTestCase): + self.assertTrue(type(ret) == RedhatOSUtil) + self.assertEquals(ret.get_service_name(), "waagent") + ++ ret = _get_osutil(distro_name="rhel", ++ distro_code_name="", ++ distro_full_name="", ++ distro_version="7") ++ self.assertTrue(type(ret) == RedhatOSUtil) ++ self.assertEquals(ret.get_service_name(), "waagent") ++ + ret = _get_osutil(distro_name="centos", + distro_code_name="", + distro_full_name="", +-- +2.29.2 + diff --git a/WALinuxAgent.spec b/WALinuxAgent.spec index f706c8d..3461261 100644 --- a/WALinuxAgent.spec +++ b/WALinuxAgent.spec @@ -3,7 +3,7 @@ Name: WALinuxAgent Version: 2.2.52 -Release: 3%{?dist} +Release: 4%{?dist} Summary: The Microsoft Azure Linux Agent License: ASL 2.0 @@ -15,6 +15,7 @@ Source1: module-setup.sh Patch0: 0001-update-array.tostring-and-json.loads-without-encodin.patch Patch1: 0002-handle-py3.9-check-in-future.py.patch Patch2: 0003-fix-pylint.patch +Patch3: 0004-Fix-distro-resolution-for-RedHat-2083.patch BuildArch: noarch @@ -61,6 +62,7 @@ Udev rules specific to Microsoft Azure Virtual Machines. %patch0 -p1 %patch1 -p1 %patch2 -p1 +%patch3 -p1 %build %py3_build @@ -123,10 +125,13 @@ install -m0755 -D -t %{buildroot}%{_prefix}/lib/dracut/modules.d/%{dracut_modnam %endif %changelog +* Tue Jan 26 2021 Vitaly Kuznetsov - 2.2.52-4 +- Fix distro resolution for RedHat + * Mon Jan 25 2021 Fedora Release Engineering - 2.2.52-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild -* Fri Jan 15 2021 italy Kuznetsov - 2.2.52-2 +* Fri Jan 15 2021 Vitaly Kuznetsov - 2.2.52-2 - Add udev rules to initramfs (#1909287) * Wed Dec 09 2020 Vitaly Kuznetsov - 2.2.52-1