Bug #34469
closedRetain packages on Repository does not synchronize the specified number of packages
Description
Description of problem:
- Retain package versions option on the repository does not retain the specified number of package versions after synchronization.
Version-Release number of selected component (if applicable):
- satellite-7.0.0-0.5.beta.el7sat.noarch
- foreman-3.1.1.4-1.el7sat.noarch
How reproducible:
- Always
Steps to Reproduce:
1. Create a repository to sync a custom product.
2. On the upstream location, add one package and create the repodata.
3. Sync the repository on the Satellite with the following settings.
Retain Package: 1
Mirroring Policy: Additive
4. Add another package to the upstream location and recreate the repodata again.
5. Sync the repository on the Satellite with the following settings.
Retain Package: 2
Mirroring Policy: Additive
Actual results:
1. First Sync
The upstream repository:
~~~
- ls
kernel-4.18.0-80.el8.x86_64.rpm repodata
~~~
- hammer repository info --id 27
Id: 27
Name: CUSTOM_REPO_3
Label: CUSTOM_REPO_3
Description:
Organization: RedHat
Red Hat Repository: no
Content Type: yum
Mirror on Sync: no
Url: http://upstreamrepo.example.com/repos/satellite_custom_test_repo/
Publish Via HTTP: yes
Published At: https://satellite.example.com/pulp/content/RedHat/Library/custom/CUSTOM_REPOSITORIES/CUSTOM_REPO_3/
Relative Path: RedHat/Library/custom/CUSTOM_REPOSITORIES/CUSTOM_REPO_3
Download Policy: on_demand
Ignorable Content Units:
HTTP Proxy:
HTTP Proxy Policy: global_default_http_proxy
Product:
Id: 294
Name: CUSTOM_REPOSITORIES
GPG Key:
Sync:
Status: Success
Last Sync Date: 1 minute
Created: 2022/02/13 06:02:55
Updated: 2022/02/13 06:02:58
Content Counts:
Packages: 1
Source RPMS: 0
Package Groups: 0
Errata: 0
Module Streams: 0
~~~
~~~
name | base_path | relative_path
----------------------+---------------------------------------------------------+---------------------------------------------------------------
CUSTOM_REPO_3-271771 | RedHat/Library/custom/CUSTOM_REPOSITORIES/CUSTOM_REPO_3 | Packages/k/kernel-4.18.0-80.el8.x86_64.rpm
CUSTOM_REPO_3-271771 | RedHat/Library/custom/CUSTOM_REPOSITORIES/CUSTOM_REPO_3 | Packages/k/kernel-4.18.0-80.el8.x86_64.rpm
CUSTOM_REPO_3-271771 | RedHat/Library/custom/CUSTOM_REPOSITORIES/CUSTOM_REPO_3 | Packages/k/kernel-4.18.0-80.el8.x86_64.rpm
CUSTOM_REPO_3-271771 | RedHat/Library/custom/CUSTOM_REPOSITORIES/CUSTOM_REPO_3 | Packages/k/kernel-4.18.0-80.el8.x86_64.rpm
CUSTOM_REPO_3-271771 | RedHat/Library/custom/CUSTOM_REPOSITORIES/CUSTOM_REPO_3 | Packages/k/kernel-4.18.0-80.el8.x86_64.rpm
~~~
2. Second Sync after increasing the Retain Package versions to 2.
~~~
hammer> repository info --id 27
Id: 27
Name: CUSTOM_REPO_3
Label: CUSTOM_REPO_3
Description:
Organization: RedHat
Red Hat Repository: no
Content Type: yum
Mirror on Sync: no
Url: http://upstreamrepo.example.com/repos/satellite_custom_test_repo/
Publish Via HTTP: yes
Published At: https://satellite.example.com/pulp/content/RedHat/Library/custom/CUSTOM_REPOSITORIES/CUSTOM_REPO_3/
Relative Path: RedHat/Library/custom/CUSTOM_REPOSITORIES/CUSTOM_REPO_3
Download Policy: on_demand
Ignorable Content Units:
HTTP Proxy:
HTTP Proxy Policy: global_default_http_proxy
Product:
Id: 294
Name: CUSTOM_REPOSITORIES
GPG Key:
Sync:
Status: Success
Last Sync Date: 8 minutes
Created: 2022/02/13 06:02:55
Updated: 2022/02/13 06:09:52
Content Counts:
Packages: 1 <-------- Package count is still one.
Source RPMS: 0
Package Groups: 0
Errata: 0
Module Streams: 0
~~~
The package changed to the newest version from the upstream repository and the old version was removed.
name | base_path | relative_path
----------------------+---------------------------------------------------------+------------------------------------------------------
CUSTOM_REPO_3-271771 | RedHat/Library/custom/CUSTOM_REPOSITORIES/CUSTOM_REPO_3 | Packages/k/kernel-4.18.0-80.1.2.el8_0.x86_64.rpm
CUSTOM_REPO_3-271771 | RedHat/Library/custom/CUSTOM_REPOSITORIES/CUSTOM_REPO_3 | Packages/k/kernel-4.18.0-80.1.2.el8_0.x86_64.rpm
CUSTOM_REPO_3-271771 | RedHat/Library/custom/CUSTOM_REPOSITORIES/CUSTOM_REPO_3 | Packages/k/kernel-4.18.0-80.1.2.el8_0.x86_64.rpm
CUSTOM_REPO_3-271771 | RedHat/Library/custom/CUSTOM_REPOSITORIES/CUSTOM_REPO_3 | Packages/k/kernel-4.18.0-80.1.2.el8_0.x86_64.rpm
CUSTOM_REPO_3-271771 | RedHat/Library/custom/CUSTOM_REPOSITORIES/CUSTOM_REPO_3 | Packages/k/kernel-4.18.0-80.1.2.el8_0.x86_64.rpm
3. Added another package to the upstream repository and synced again with Retain Package Versions package value 5
Upstream Repository.
~~~
- ll
total 1228
rw-r--r-. 1 root root 415364 May 14 2019 kernel-4.18.0-80.1.2.el8_0.x86_64.rpm
rw-r--r-. 1 root root 419436 Jun 17 2019 kernel-4.18.0-80.4.2.el8_0.x86_64.rpm
rw-r--r-. 1 root root 409836 Mar 21 2019 kernel-4.18.0-80.el8.x86_64.rpm
drwxr-xr-x. 2 root root 4096 Feb 13 12:03 repodata
~~~
- zgrep metadata repodata/*primary*
repodata/caa37f79857badc4a11db3de3451b146364ebb76390c6b9e879ad6e6943800a9-primary.xml.gz:<metadata xmlns="http://linux.duke.edu/metadata/common" xmlns:rpm="http://linux.duke.edu/metadata/rpm" packages="3">
~~~
hammer> repository info --id 27
Id: 27
Name: CUSTOM_REPO_3
Label: CUSTOM_REPO_3
Description:
Organization: RedHat
Red Hat Repository: no
Content Type: yum
Mirror on Sync: no
Url: http://upstreamrepo.example.com/repos/satellite_custom_test_repo/
Publish Via HTTP: yes
Published At: https://satellite.example.com/pulp/content/RedHat/Library/custom/CUSTOM_REPOSITORIES/CUSTOM_REPO_3/
Relative Path: RedHat/Library/custom/CUSTOM_REPOSITORIES/CUSTOM_REPO_3
Download Policy: on_demand
Ignorable Content Units:
HTTP Proxy:
HTTP Proxy Policy: global_default_http_proxy
Product:
Id: 294
Name: CUSTOM_REPOSITORIES
GPG Key:
Sync:
Status: Success
Last Sync Date: 3 minutes
Created: 2022/02/13 06:02:55
Updated: 2022/02/13 06:37:24
Content Counts:
Packages: 1
Source RPMS: 0
Package Groups: 0
Errata: 0
Module Streams: 0
~~~
Similarly like before the package changed to the newer version but the older versions were removed even though the Retain Package Versions option is set to 5
name | base_path | relative_path
----------------------+---------------------------------------------------------+---------------------------------------------------------
CUSTOM_REPO_3-271771 | RedHat/Library/custom/CUSTOM_REPOSITORIES/CUSTOM_REPO_3 | Packages/k/kernel-4.18.0-80.4.2.el8_0.x86_64.rpm
CUSTOM_REPO_3-271771 | RedHat/Library/custom/CUSTOM_REPOSITORIES/CUSTOM_REPO_3 | Packages/k/kernel-4.18.0-80.4.2.el8_0.x86_64.rpm
CUSTOM_REPO_3-271771 | RedHat/Library/custom/CUSTOM_REPOSITORIES/CUSTOM_REPO_3 | Packages/k/kernel-4.18.0-80.4.2.el8_0.x86_64.rpm
CUSTOM_REPO_3-271771 | RedHat/Library/custom/CUSTOM_REPOSITORIES/CUSTOM_REPO_3 | Packages/k/kernel-4.18.0-80.4.2.el8_0.x86_64.rpm
CUSTOM_REPO_3-271771 | RedHat/Library/custom/CUSTOM_REPOSITORIES/CUSTOM_REPO_3 | Packages/k/kernel-4.18.0-80.4.2.el8_0.x86_64.rpm
- Each time the repository is synced after adding new packages, the old packages are removed and the specified count of versions is not retained.
Expected results:
- The specified count of package versions should be synced.