GoogleCloudPlatform / GoogleCloudPlatform/osconfig
OSConfig agent is not upgrading an already installed yum package
- Dominant language
- Go
- Stars
- 99
- Forks
- 113
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 5
Description
When running a patch job on a machine that has yum as the package manager, the OSConfig agent isn't upgrading a package that is already installed with an older version.
Steps to reproduce:
1. Downgrade `curl` package on the machine by running `yum downgrade curl`. This downgrades the `curl` to version `7.69.1-1.fc32`
2. Run an OSConfig patch job passing `curl` in the exclusive packages list
3. The logs show that it has updated the `curl` package to the newer version: `Success. Updated 1 packages: ["curl x86_64 7.69.1-8.fc32"]`
However, the `curl` package installed in the system is still of the older version. If we manually run `yum update curl`, only then it actually gets upgraded.
Looking at the code, the [InstallYumUpdates](https://github.com/GoogleCloudPlatform/osconfig/blob/master/ospatch/yum_update.go#L125) function is being called which is basically running [yum install --assumeyes curl](https://github.com/GoogleCloudPlatform/osconfig/blob/master/packages/yum.go#L70)
And `yum install` command doesn't upgrade a package if it is already installed in the system.
Is this a bug? Or am I missing something here?
yum version:
```
4.6.0
Installed: dnf-0:4.6.0-1.fc32.noarch at Tue Jul 19 09:42:52 2022
Built : Fedora Project at Mon Mar 1 11:54:54 2021
Installed: rpm-0:4.15.1.1-1.fc32.1.x86_64 at Tue Jul 19 09:37:30 2022
Built : Fedora Project at Mon Mar 22 12:06:30 2021
```
Contributor guide
Assessment
This issue has not been assessed yet.