Bug 1491646

Summary: Having empty repo in a Content View, Capsule sync of the CV fails on retrieving this repo metadata
Product: Red Hat Satellite Reporter: Pavel Moravec <pmoravec>
Component: RepositoriesAssignee: Justin Sherrill <jsherril>
Status: CLOSED ERRATA QA Contact: Sanket Jagtap <sjagtap>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.2.11CC: andrew.schofield, bbuckingham, dgross, dmoessne, ehelms, gapatil, jsherril, kabbott, sjagtap, sokeeffe, tdaianov
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-02-21 16:54:17 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Pavel Moravec 2017-09-14 10:48:30 UTC
Description of problem:
Having an empty repository in a Content View and publishing this C.V. or promoting to a L.E., an (automated) attempt to synchronize the C.V. content fails on trying to sync this empty repo with error:

PulpCodedException: Error retrieving metadata: NOT FOUND

Also manual Capsule sync fails the same way.

This situation (empty repo in a C.V.) can happen due to various legitimate reasons and shouldnt be dealt as a user/config error.

Root cause behind this bug: the empty repo is never published on Satellite. Because step Actions::Pulp::Repository::DistributorPublish is called with "matching_content: true" - since previously published content (empty) matches current content (empty).


Version-Release number of selected component (if applicable):
tfm-rubygem-katello-3.0.0.144-1.el7sat.noarch


How reproducible:
100%


Steps to Reproduce:
0. Satellite with a Capsule in Library environment
1. Have a repo with 1 package
2. Add the repo to a Content View and use filter to exclude the package
3. Publish the repo
4. Check task Actions::Katello::ContentView::CapsuleGenerateAndSync triggered on background
5. Try to sync the Cpasule manually


Actual results:
4. and 5. fails with error

PulpCodedException: Error retrieving metadata: NOT FOUND

on the empty repo


Expected results:
No such error


Additional info:

Comment 2 Pavel Moravec 2017-09-14 11:33:19 UTC
(not sure if my explanation behind matching_content is correct, but simply I see matching_content=true and hence also matching_content_skip=true in Actions::Pulp::Repository::DistributorPublish, and no repo publish called)

Comment 7 Brad Buckingham 2017-09-20 21:06:29 UTC
Created redmine issue http://projects.theforeman.org/issues/21048 from this bug

Comment 8 Satellite Program 2017-09-27 20:07:58 UTC
Upstream bug assigned to jsherril

Comment 9 Satellite Program 2017-09-27 20:08:01 UTC
Upstream bug assigned to jsherril

Comment 11 Satellite Program 2017-10-19 16:08:39 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue http://projects.theforeman.org/issues/21048 has been resolved.

Comment 12 Brad Buckingham 2017-10-20 14:19:45 UTC
*** Bug 1502101 has been marked as a duplicate of this bug. ***

Comment 13 Sanket Jagtap 2017-12-01 06:38:01 UTC
Build: Satellite 6.3.0 snap26

Verification steps:

1) External capsule with "Empty" lifecycle Env
2) CV with empty content , which used filter to exclude all packages
3) Synced the CV with library env 
4) promoted the CV to "Empty" Lifecycle Env
5) Actions::Katello::ContentView::CapsuleGenerateAndSync was triggered
6) The task was successful

Task Result:
Id: eaaeaa63-bf96-48d3-acb5-cb4cda5c85ec

Label: Actions::Katello::ContentView::CapsuleGenerateAndSync

Status: stopped

Result: success

Started at: 2017-12-01 05:17:01 UTC

Ended at: 2017-12-01 05:18:11 UTC

    Plan
    Run
    Finalize
    Execution History

3: Actions::BulkAction (success) [ 70.11s / 42.18s ] Sub plans

Started at: 2017-12-01 05:17:01 UTC

Ended at: 2017-12-01 05:18:11 UTC

Real time: 70.11s

Execution time (excluding suspended state): 42.18s

Input:

---
action_class: Actions::Katello::CapsuleContent::Sync
target_ids:
- 3
target_class: SmartProxy
args:
- content_view_id: 9
  environment_id: 5
current_user_id: 3
locale: en

Output:

---
planned_count: 1
total_count: 1
failed_count: 0
pending_count: 0
success_count: 1

Manual Sync of capsule was successfull.

Also , registering a content host , didn't lead to 404 error

rpm -Uvh http://cisco-b200m3-01/pub/katello-ca-consumer-latest.noarch.rpm
Retrieving http://cisco-b200m3-01./pub/katello-ca-consumer-latest.noarch.rpm
Preparing...                          ################################# [100%]
Updating / installing...
   1:katello-ca-consumer-cisco-b200m3-################################# [100%]
[root@ibm-ls22-01 ~]# subscription-manager register --org="Default_Organization" --activationkey="empty_ak"
The system has been registered with ID: 6a56d6fc-ae2f-4aa4-8c24-201a4569e752 

Installed Product Current Status:
Product Name: Red Hat Enterprise Linux Server
Status:       Not Subscribed

Unable to find available subscriptions for all your installed products.

yum repolist
Loaded plugins: product-id, search-disabled-repos, subscription-manager
Default_Organization_test1_bugupload/primary                                                                                                                                                |  151 B  00:00:00     
repo id                                                                                                             repo name                                                                                status
!Default_Organization_test1_bugupload                                                                               bugupload                                                                                0
repolist: 0
[root@ibm-ls22-01 ~]# yum install jenkins
Loaded plugins: product-id, search-disabled-repos, subscription-manager
Default_Organization_test1_bugupload                                                                                                                                                        | 2.1 kB  00:00:00     
(1/2): Default_Organization_test1_bugupload/group                                                                                                                                           |  124 B  00:00:03     
(2/2): Default_Organization_test1_bugupload/updateinfo                                                                                                                                      |   92 B  00:00:06     
No package jenkins available.
Error: Nothing to do

Comment 14 Satellite Program 2018-02-21 16:54:17 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, 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-2018:0336