f5ab1b1cd8
This is an automated DistroBaker update from upstream sources. If you do not know what this is about or would like to opt out, contact the OSCI team. Source: https://src.fedoraproject.org/rpms/WALinuxAgent.git#d1df06d88f74b391090f4771a4df84fae589809b
65 lines
2.6 KiB
Diff
65 lines
2.6 KiB
Diff
From 3420fef144cf9a5be62cfae16f64c298ca397a17 Mon Sep 17 00:00:00 2001
|
|
From: Paula Gombar <gombarica@gmail.com>
|
|
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 <vkuznets@redhat.com>
|
|
---
|
|
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
|
|
|