Azure / LinuxPatchExtension

Microsoft Azure VM Guest Linux Patch Extension
Apache License 2.0
10 stars 8 forks source link

Fix the issue that if there are conflicting packages in the yum install command then installation of all the packages in the command fails. #248

Closed GAURAVRAMRAKHYANI closed 7 months ago

GAURAVRAMRAKHYANI commented 7 months ago

There are two issues: (a) In the method add_arch_dependencies, there are conflicting packages added in the same yum install command. (b) If there are conflicting packages in the yum install command then installation of all the packages in the command fails.

Issue: If there are two updates available in yum with same name but different architecture and different versions then if they both are attempted to be installed in single command then install fails due to conflict.

For example following are the packages: subscription-manager-rhsm-certificates-1.28.36-3.el8_8.x86_64 subscription-manager-rhsm-certificates-20220623-1.el8.noarch

Installing both these packages in same command fails with error in the below screenshot. Here, the package name is same for both the packages: subscription-manager-rhsm-certificates Architecture is different: x86_64 and noarch Version is also different: 1.28.36-3 and 20220623-1

The installation would succeed if version is same and only architecture is different.

This issue is not new in parallel patching, this issue should be there before parallel patching was implemented because in yum package manager, we check the packages with same name but different architecture and install them in single commands. We don't check for their versions.

Fix If there are two packages with same name but different architecture, we should verify that the version of the packages should be same before adding them as dependent package.

The above fix will only fix the case when we are adding the second package with same name as arch dependency in the function add_arch_dependencies. This will not fix the case when both packages are added in the same batch outside the function add_arch_dependencies. Added --skip-broken parameter in the yum install command to resolve this issue. If there are conflicting packages in the batch and --skip-broken is mentioned, then yum will resolve the conflict and install one of the conflicting package as part of batch patching and skip installation of the other package. This will avoid failure of all the packages in the batch.

codecov[bot] commented 7 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 90.95%. Comparing base (a52fe4b) to head (b7f04f8).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #248 +/- ## ======================================= Coverage 90.95% 90.95% ======================================= Files 91 91 Lines 15723 15723 ======================================= Hits 14301 14301 Misses 1422 1422 ``` | [Flag](https://app.codecov.io/gh/Azure/LinuxPatchExtension/pull/248/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Azure) | Coverage Δ | | |---|---|---| | [python27](https://app.codecov.io/gh/Azure/LinuxPatchExtension/pull/248/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Azure) | `90.95% <100.00%> (ø)` | | | [python39](https://app.codecov.io/gh/Azure/LinuxPatchExtension/pull/248/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Azure) | `90.95% <100.00%> (ø)` | | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Azure#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

kjohn-msft commented 7 months ago

Please wait for @rane-rajasi 's review / approval to merge