Repository: Azure/WALinuxAgent
Pull request #2696 (2022-11-03 20:02:09)

drop cgroup support for rhel (#2685)
(cherry picked from commit 60f5b4dd465b3921ca50ec2e5c9fc4f1987d90b8)

<!-- DO NOT DELETE THIS TEMPLATE -->

## Description

Issue # <!-- if any -->
<!--
Please add an informative description that covers that changes made by the pull request. 
This checklist is used to make sure that common issues in a pull request are addressed.
This will expedite the process of getting your pull request merged and avoid extra work on your part to fix issues discovered during the review process.
-->

---

### PR information
- [ ] The title of the PR is clear and informative.
- [ ] There are a small number of commits, each of which has an informative message. This means that previously merged commits do not appear in the history of the PR. For information on cleaning up the commits in your pull request, [see this page](https://github.com/Azure/azure-powershell/blob/master/documentation/development-docs/cleaning-up-commits.md).
- [ ] If applicable, the PR references the bug/issue that it fixes in the description.
- [ ] New Unit tests were added for the changes made

### Quality of Code and Contribution Guidelines
- [ ] I have read the [contribution guidelines](https://github.com/Azure/WALinuxAgent/blob/master/.github/CONTRIBUTING.md).

codecov[bot]: # [Codecov](https://codecov.io/gh/Azure/WALinuxAgent/pull/2696?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Azure) Report
> Merging [#2696](https://codecov.io/gh/Azure/WALinuxAgent/pull/2696?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Azure) (a496cbb) into [develop](https://codecov.io/gh/Azure/WALinuxAgent/commit/a82427fc7012b133e5a799984d00e43f53ea2a9f?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Azure) (a82427f) will **not change** coverage.
> The diff coverage is `n/a`.

```diff
@@           Coverage Diff            @@
##           develop    #2696   +/-   ##
========================================
  Coverage    72.01%   72.01%           
========================================
  Files          104      104           
  Lines        15750    15750           
  Branches      2242     2242           
========================================
  Hits         11343    11343           
  Misses        3892     3892           
  Partials       515      515           
```


| [Impacted Files](https://codecov.io/gh/Azure/WALinuxAgent/pull/2696?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Azure) | Coverage Δ | |
|---|---|---|
| [azurelinuxagent/common/cgroupapi.py](https://codecov.io/gh/Azure/WALinuxAgent/pull/2696/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Azure#diff-YXp1cmVsaW51eGFnZW50L2NvbW1vbi9jZ3JvdXBhcGkucHk=) | `81.00% <ø> (ø)` | |

Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Azure). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Azure)


Patch:
diff --git a/azurelinuxagent/common/cgroupapi.py b/azurelinuxagent/common/cgroupapi.py
index 2935e251..d7040747 100644
--- a/azurelinuxagent/common/cgroupapi.py
+++ b/azurelinuxagent/common/cgroupapi.py
@@ -60,7 +60,7 @@ class CGroupsApi(object):
         except ValueError:
             return False
         return ((distro_name.lower() == 'ubuntu' and distro_version.major >= 16) or
-                (distro_name.lower() in ("centos", "redhat") and
+                (distro_name.lower() == "centos" and
                  ((distro_version.major == 7 and distro_version.minor >= 4) or distro_version.major >= 8)))
 
     @staticmethod


Test patch:
diff --git a/tests/common/test_cgroupapi.py b/tests/common/test_cgroupapi.py
index 3b70214d..ca380ed2 100644
--- a/tests/common/test_cgroupapi.py
+++ b/tests/common/test_cgroupapi.py
@@ -57,13 +57,13 @@ class CGroupsApiTestCase(_MockedFileSystemTestCase):
             (['ubuntu', '20.04', 'focal'], True),
             (['ubuntu', '20.10', 'groovy'], True),
             (['centos', '7.8', 'Source'], True),
-            (['redhat', '7.8', 'Maipo'], True),
-            (['redhat', '7.9.1908', 'Core'], True),
+            (['redhat', '7.8', 'Maipo'], False),
+            (['redhat', '7.9.1908', 'Core'], False),
             (['centos', '8.1', 'Source'], True),
-            (['redhat', '8.2', 'Maipo'], True),
-            (['redhat', '8.2.2111', 'Core'], True),
+            (['redhat', '8.2', 'Maipo'], False),
+            (['redhat', '8.2.2111', 'Core'], False),
             (['centos', '7.4', 'Source'], True),
-            (['redhat', '7.4', 'Maipo'], True),
+            (['redhat', '7.4', 'Maipo'], False),
             (['centos', '7.5', 'Source'], True),
             (['centos', '7.3', 'Maipo'], False),
             (['redhat', '7.2', 'Maipo'], False),