Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 2041497 - Incremental CV update fails with 400 HTTP error
Summary: Incremental CV update fails with 400 HTTP error
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Content Views
Version: 6.10.1
Hardware: x86_64
OS: Linux
high
high
Target Milestone: 6.11.0
Assignee: Ian Ballou
QA Contact: Lai
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-01-17 14:02 UTC by Jan Senkyrik
Modified: 2023-03-30 06:00 UTC (History)
17 users (show)

Fixed In Version: tfm-rubygem-katello-4.3.0.3-1
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 2055662 (view as bug list)
Environment:
Last Closed: 2022-07-05 14:32:03 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 34357 0 High Closed Incremental CV update fails with 400 HTTP error 2022-02-08 22:23:50 UTC
Red Hat Knowledge Base (Solution) 6706781 0 None None None 2022-02-04 14:04:35 UTC
Red Hat Product Errata RHSA-2022:5498 0 None None None 2022-07-05 14:32:15 UTC

Description Jan Senkyrik 2022-01-17 14:02:47 UTC
Description of problem:

- Unable to create an incremental CV update. The action fails:

[root@jsenkyri-satellite-latest ~]# hammer content-view version incremental-update --content-view-version-id 17 --errata-ids 15612
[.............................................................................................                                                                                ] [54%]
Incremental Update incomplete.
Error: Error message: the server returns an error
HTTP status code: 400
Response headers: {"Date"=>"Mon, 17 Jan 2022 13:34:17 GMT", "Server"=>"gunicorn", "Content-Type"=>"application/json", "Vary"=>"Accept,Cookie", "Allow"=>"POST, OPTIONS", "X-Frame-Options"=>"SAMEORIGIN", "Content-Length"=>"110", "Correlation-ID"=>"e5e90bcb-a6ac-4d73-af84-d89a3ea18180", "Access-Control-Expose-Headers"=>"Correlation-ID", "Via"=>"1.1 jsenkyri-satellite-latest.sysmgmt.lan", "Connection"=>"close"}
Response body: ["Version 1 does not exist for repository 'Red_Hat_Enterprise_Linux_8_for_x86_64_-_AppStream_RPMs_8-581060'."]



Version-Release number of selected component (if applicable):
- Satellite 6.10

How reproducible:
- Always

Steps to Reproduce:

1. Create a CV:

hammer> content-view info --id 3
Id:                           3
Name:                         rhel8
Label:                        rhel8
Composite:                    false
Description:                  
Content Host Count:           0
Solve Dependencies:           false
Organization:                 Default Organization
Yum Repositories:             
 1) Id:    7
    Name:  Red Hat Enterprise Linux 8 for x86_64 - BaseOS RPMs 8
    Label: Red_Hat_Enterprise_Linux_8_for_x86_64_-_BaseOS_RPMs_8
 2) Id:    6
    Name:  Red Hat Enterprise Linux 8 for x86_64 - AppStream RPMs 8
    Label: Red_Hat_Enterprise_Linux_8_for_x86_64_-_AppStream_RPMs_8
Container Image Repositories: 

OSTree Repositories:          

Lifecycle Environments:       
 1) Id:   1
    Name: Library
 2) Id:   2
    Name: test
Versions:                     
 1) Id:        18
    Version:   2.1
    Published: 2022/01/17 13:34:08
 2) Id:        16
    Version:   1.0
    Published: 2022/01/17 12:53:25
 3) Id:        17
    Version:   2.0
    Published: 2022/01/17 12:53:57
Components:                   

Activation Keys:



2. Try to add errata:

[root@jsenkyri-satellite-latest ~]# hammer content-view version list
---|-------------------------------|---------|----------------------------------------------------------------------------------|-----------------------
ID | NAME                          | VERSION | DESCRIPTION                                                                      | LIFECYCLE ENVIRONMENTS
---|-------------------------------|---------|----------------------------------------------------------------------------------|-----------------------
14 | rhel7 11.2                    | 11.2    |                                                                                  |                       
13 | rhel7 11.1                    | 11.1    |                                                                                  |                       
12 | rhel7 11.0                    | 11.0    |                                                                                  | Library               
11 | rhel7 10.0                    | 10.0    |                                                                                  |                       
10 | rhel7 9.0                     | 9.0     |                                                                                  |                       
15 | rhel7 8.1                     | 8.1     |                                                                                  |                       
9  | rhel7 8.0                     | 8.0     |                                                                                  |                       
8  | rhel7 7.0                     | 7.0     |                                                                                  |                       
7  | rhel7 6.0                     | 6.0     |                                                                                  |                       
6  | rhel7 5.0                     | 5.0     | aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa... |                       
5  | rhel7 4.0                     | 4.0     |                                                                                  |                       
4  | rhel7 3.0                     | 3.0     |                                                                                  |                       
17 | rhel8 2.0                     | 2.0     |                                                                                  | Library, test         
3  | rhel7 2.0                     | 2.0     | aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa... |                       
16 | rhel8 1.0                     | 1.0     |                                                                                  |                       
2  | rhel7 1.0                     | 1.0     |                                                                                  |                       
1  | Default Organization View 1.0 | 1.0     |                                                                                  | Library               
---|-------------------------------|---------|----------------------------------------------------------------------------------|-----------------------



[root@jsenkyri-satellite-latest ~]# hammer erratum list | grep RHBA-2022:0106
15612 | RHBA-2022:0106              | bugfix      | .NET 6.0 bugfix update                                                           | 2022-01-11 | 2022-01-11


[root@jsenkyri-satellite-latest ~]# hammer content-view version incremental-update --content-view-version-id 17 --errata-ids 15612
[.............................................................................................                                                                                ] [54%]
Incremental Update incomplete.
Error: Error message: the server returns an error
HTTP status code: 400
Response headers: {"Date"=>"Mon, 17 Jan 2022 13:34:17 GMT", "Server"=>"gunicorn", "Content-Type"=>"application/json", "Vary"=>"Accept,Cookie", "Allow"=>"POST, OPTIONS", "X-Frame-Options"=>"SAMEORIGIN", "Content-Length"=>"110", "Correlation-ID"=>"e5e90bcb-a6ac-4d73-af84-d89a3ea18180", "Access-Control-Expose-Headers"=>"Correlation-ID", "Via"=>"1.1 jsenkyri-satellite-latest.sysmgmt.lan", "Connection"=>"close"}
Response body: ["Version 1 does not exist for repository 'Red_Hat_Enterprise_Linux_8_for_x86_64_-_AppStream_RPMs_8-581060'."]


Additional info:
- I tried with 2 different CVs (rhel7 and rhel8)
- This is a fresh 6.10 install
- Can provide access to reproducer

Comment 2 Pavel Moravec 2022-01-19 09:33:45 UTC
I can not reproduce this on some small CV/repo (i.e. Sat6.10 tools for RHEL8):

1) sync the repo
2) have CV with that repo BUT applied filter "exclude puppet-agent RPM" (this will remove 1 RPM and 1 errata)
3) incremental update of the CV to add the package and also add the errata:

hammer> content-view version incremental-update --organization-id 1 --content-view-version-id 16 --package-ids 95140
[.....................................................................................................................................................................................] [100%]
Content View: cv_tools_rhel8 version 2.1
Added Content:
  Packages:
        puppet-agent-6.22.1-1.el8sat.x86_64
hammer> content-view version incremental-update --organization-id 1 --content-view-version-id 16 --errata-ids 1
[.....................................................................................................................................................................................] [100%]
Content View: cv_tools_rhel8 version 2.2
Added Content:
  Errata:
        RHBA-2021:4701
  Packages:
        puppet-agent-6.22.1-1.el8sat.x86_64
hammer>



So maybe something related to bigger repos?

Comment 3 Pavel Moravec 2022-01-19 10:52:45 UTC
.. and also incremental update of CV with RHEL7 (and another with RHEL8 baseos+appstream) went well for me.

The bug hit isn't much generic as originally expected.

Comment 4 Pavel Moravec 2022-01-19 11:23:55 UTC
OK, there *is* a deterministic reproducer:

1) Create a custom product and repo
2) Upload a package to it
3) Create a CV, add that repo to it and publish
4) Upload another RPM (ideally same Name but higher Version/Release) to the repo
5) incremental update of the CV version fails:

hammer> content-view version incremental-update --organization-id 1 --content-view-version-id 33 --package-ids 95164
[...................................................................................                                                                                                   ] [46%]
Incremental Update incomplete.
Error: Error message: the server returns an error
HTTP status code: 400
Response headers: {"Date"=>"Wed, 19 Jan 2022 11:19:52 GMT", "Server"=>"gunicorn", "Content-Type"=>"application/json", "Vary"=>"Accept,Cookie", "Allow"=>"POST, OPTIONS", "X-Frame-Options"=>"SAMEORIGIN", "Content-Length"=>"74", "Correlation-ID"=>"2f1977aa-d8c6-443f-aa97-984158ef1b5d", "Access-Control-Expose-Headers"=>"Correlation-ID", "Via"=>"1.1 pmoravec-sat610.satotest.gsslab.brq2.redhat.com", "Connection"=>"close"}
Response body: ["Version 1 does not exist for repository 'sos_repo_incremental-695507'."]
hammer> 


So it seem the problem happens when incrementally updating some content that was *missing* in _root_ repository (katello term) at the time of original CV publish / when the CV version (being incremented from) was created.

Anyway, this is the typical use case of incremental update, the "restrict content via filters" is more artificial => quite severe bug (for incremental update).

Comment 5 Pavel Moravec 2022-01-19 11:46:15 UTC
Lai,
isn't there some automated test for this? I would expect there is / should be..

Comment 6 Lai 2022-01-24 14:48:17 UTC
Hey Pavel,

We do have some tests around incremental update.  Here are some:

https://github.com/SatelliteQE/robottelo/blob/master/tests/foreman/cli/test_contentview.py#L3732

https://github.com/SatelliteQE/robottelo/blob/master/tests/foreman/ui/test_contentview.py#L2980

https://github.com/SatelliteQE/robottelo/blob/master/tests/foreman/ui/test_contentview.py#L3041

And then there's a few incremental update test in api/test_errata.py.

If you see that there's some missing coverage, I can put those on my backlog.

Comment 9 Ian Ballou 2022-01-28 22:35:06 UTC
I was looking into this community issue which I believe is the same one: https://community.theforeman.org/t/unable-to-publish-an-incremental-cv-update/27085/7

I'm not sure the root cause, but I found some potentially helpful info when debugging the Pulp copy task during incremental update:

For the copy API call to Pulp during MultiCopyUnits, it appears that the "dest_repo" field is set incorrectly to the Pulp repository that is attached to one of the content view version's non-archived repositories.  This incorrect assignment comes from the destination repository's RepositoryReference: https://github.com/Katello/katello/blob/master/app/services/katello/pulp3/repository/yum.rb#L97

It should be the dest_repo for the archived repository instead.  Somehow, the RepositoryReference has a different repository from the ::Katello::Repository :

[87] pry(main)> ::Katello::Pulp3::Repository::Yum.new(::Katello::Repository.find(60), SmartProxy.pulp_primary).repository_reference
=> #<Katello::Pulp3::RepositoryReference:0x000055a2ca5cbb98
 id: 32,
 repository_href: "/pulp/api/v3/repositories/rpm/rpm/afa0e2cf-d25c-4ce9-b367-a54f5be2c481/",
 content_view_id: 18,
 root_repository_id: 16>

compared to:

[89] pry(main)> ::Katello::Repository.find(60).version_href
=> "/pulp/api/v3/repositories/rpm/rpm/d49ad868-8b54-4058-8195-da08a4a89529/versions/2/"



I only saw this happen when I tried Pavel's reproducer steps by uploading a new RPM to a repository.  It does not occur if I test instead by filtering out errata and incrementally adding them back in, for example.

Comment 10 Ian Ballou 2022-01-31 22:13:46 UTC
Created redmine issue https://projects.theforeman.org/issues/34357 from this bug

Comment 11 Brad Buckingham 2022-02-09 13:35:50 UTC
Moving to POST as the upstream PR is now merged.

Comment 15 wclark 2022-02-16 20:26:35 UTC
Hotfix RPM is available for Satellite 6.10.2

OBTAINING THE HOTFIX:

The hotfix RPM is too large to be provided as an attachment on Bugzilla. Therefore please contact Red Hat Technical Support to obtain the hotfix.

INSTALLING THE HOTFIX:

1. Take a complete backup or snapshot of Satellite 6.10.2 server

2. Obtain the hotfix RPM from Red Hat Technical Support and copy it to Satellite server

3. # yum install ./tfm-rubygem-katello-4.1.1.42-3.HOTFIXRHBZ2041497.el7sat.noarch.rpm --disableplugin=foreman-protector

4. # satellite-maintain service restart

Comment 17 Lai 2022-03-01 22:30:55 UTC
Steps to retest

1. Create some repo and sync it
2. Delete some packages from the repo
3. Create a CV, add the repo, and publish
4. Re-sync the repo to get the deleted RPMs back
5. Incrementally add one or more RPMs back in 

Expected:
Incrementally update should be successful

Actual:
Incremental update is successful

I tried this with the zoo repo and removed 'bear' and 'frog' packages.  After following the steps and doing inc update on the missing package, it was added successfully without issues.  I tried this with a ccv and that was also successful.

Verified on 7.0 snap 11.  Tested on both rhel7 and rhel8.

Comment 20 Vedashree Deshpande 2022-05-27 08:40:48 UTC
Hello, 

My customer is on 6.10.3 and still facing this issue.

Comment 21 Stephen Wadeley 2022-06-06 15:32:45 UTC
(In reply to Ian Ballou from comment #9)
> I was looking into this community issue which I believe is the same one:
> https://community.theforeman.org/t/unable-to-publish-an-incremental-cv-
> update/27085/7
> 
> I'm not sure the root cause, but I found some potentially helpful info when
> debugging the Pulp copy task during incremental update:
> 
> For the copy API call to Pulp during MultiCopyUnits, it appears that the
> "dest_repo" field is set incorrectly to the Pulp repository that is attached
> to one of the content view version's non-archived repositories.  This
> incorrect assignment comes from the destination repository's
> RepositoryReference:
> https://github.com/Katello/katello/blob/master/app/services/katello/pulp3/
> repository/yum.rb#L97
> 
> It should be the dest_repo for the archived repository instead.  Somehow,
> the RepositoryReference has a different repository from the
> ::Katello::Repository :
> 
> [87] pry(main)>
> ::Katello::Pulp3::Repository::Yum.new(::Katello::Repository.find(60),
> SmartProxy.pulp_primary).repository_reference
> => #<Katello::Pulp3::RepositoryReference:0x000055a2ca5cbb98
>  id: 32,
>  repository_href:
> "/pulp/api/v3/repositories/rpm/rpm/afa0e2cf-d25c-4ce9-b367-a54f5be2c481/",
>  content_view_id: 18,
>  root_repository_id: 16>
> 
> compared to:
> 
> [89] pry(main)> ::Katello::Repository.find(60).version_href
> =>
> "/pulp/api/v3/repositories/rpm/rpm/d49ad868-8b54-4058-8195-da08a4a89529/
> versions/2/"
> 
> 
> 
> I only saw this happen when I tried Pavel's reproducer steps by uploading a
> new RPM to a repository.  It does not occur if I test instead by filtering
> out errata and incrementally adding them back in, for example.

Hi

Pavel's steps are in comment #4

I read through the tests Lai mentioned in comment #6

All currently use filtering to create applicability but no installability.

The CLI test is specifically about not having a LCE.

@lai you could modify "test_positive_errata_inc_update_list_package"[1] to upload an RPM in place of applying a filter




the UI tests are slower than API tests, 
so you could ask @akjha if he can change his API test[2] to upload an RPM in place of applying a filter.
Or just copy and modify it.


[1] https://github.com/SatelliteQE/robottelo/blob/f8b6c8ad742bab67e0f75b0fa63fd4d5d5743476/tests/foreman/ui/test_contentview.py#L2947
[2] https://github.com/SatelliteQE/robottelo/blob/f8b6c8ad742bab67e0f75b0fa63fd4d5d5743476/tests/foreman/api/test_errata.py#L620

Comment 24 errata-xmlrpc 2022-07-05 14:32:03 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Moderate: Satellite 6.11 Release), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2022:5498


Note You need to log in before you can comment on or make changes to this bug.