Bug 1553105

Summary: composite_content_view_ids field of a content_view_version is always empty
Product: Red Hat Satellite Reporter: Evgeni Golov <egolov>
Component: Content ViewsAssignee: Andrew Kofink <akofink>
Status: CLOSED ERRATA QA Contact: Lai <ltran>
Severity: high Docs Contact:
Priority: high    
Version: 6.3.0CC: akofink, andrew.schofield, dconsoli, egolov
Target Milestone: 6.5.0Keywords: Regression, Triaged
Target Release: Unused   
Hardware: All   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-05-14 12:37:00 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 Evgeni Golov 2018-03-08 10:29:16 UTC
Description of problem:

Assume the following setup:
Composite Content View "Capsule 6.3 with RHEL7 Server" with
* Content View "RHEL7"
* Content View "Tools 6.3 RHEL7"
* Content View "Capsule 6.3 RHEL7"

For some housekeeping, I'd like to remove old versions of "RHEL7" and "Capsule 6.3 RHEL7", which are not used by the CCV anymore.

To do so, I'd request all versions of said CVs (/katello/api/content_views/:content_view_id/content_view_versions) and delete all that have an empty composite_content_view_ids, assuming the version is not used by any CCV.

The field is also empty when looking at a specific version via /katello/api/content_view_versions/:content_view_version_id.

This worked fine in 6.2.z, but fails in 6.3.0, as composite_content_view_ids is always [].

hammer shows the info correctly:
# hammer content-view info --name "Capsule 6.3 with RHEL7 Server" --organization Sat6-CI
ID:                     54
Name:                   Capsule 6.3 with RHEL7 Server
Label:                  Capsule_6_3_with_RHEL7_Server
Composite:              true
Description:            
Content Host Count:     0
Organization:           Sat6-CI
Yum Repositories:       
…
Docker Repositories:    

OSTree Repositories:    

Puppet Modules:         

Lifecycle Environments: 
 1) ID:   2
    Name: Library
Versions:               
…
Components:             
 1) ID:   4365
    Name: Capsule 6.3 RHEL7 248.0
 2) ID:   4362
    Name: Tools 6.3 RHEL7 247.0
 3) ID:   4297
    Name: RHEL7 18.0

And so does the API at /katello/api/content_views/:content_view_id in the "components" field.


Version-Release number of selected component (if applicable):
satellite-6.3.0-23.0.el7sat.noarch

How reproducible:
100%


Steps to Reproduce:
1. create (and publish) a CV
2. create (and publish) a CCV that includes the CV from step 1
3. fetch /katello/api/content_views/:content_view_id/content_view_versions for the CV

Actual results:
composite_content_view_ids is empty

Expected results:
composite_content_view_ids shows that it's used in CCV


Additional info:

Comment 1 Evgeni Golov 2018-03-08 12:10:09 UTC
Scratch the "reproducible: 100%", I can't repro this when creating *new* CV/CCVs.

But I see this on the dogfood server, and I've seen other people on IRC complaining about the same behaviour.

Comment 4 Brad Buckingham 2018-05-17 21:00:44 UTC
Hi Evgeni, could this be a duplicate of bug 1522769?

It looks like that was verified on 6.3 snap 34; however, I am not sure if that was before/after the environment above.

Comment 5 Evgeni Golov 2018-05-18 08:14:02 UTC
(In reply to Brad Buckingham from comment #4)
> Hi Evgeni, could this be a duplicate of bug 1522769?
> 
> It looks like that was verified on 6.3 snap 34; however, I am not sure if
> that was before/after the environment above.

Given I face it on a 6.3.0 GA build, unlikely. Or at least, not verified ;)

However, I cannot reliably reproduce this. Some CVs have this issue, some do not.

There is also https://bugzilla.redhat.com/show_bug.cgi?id=1573193, which seems the same bug, and even has an upstream issue attached https://projects.theforeman.org/issues/23458

Comment 8 Andrew Kofink 2018-10-08 14:33:05 UTC
Created redmine issue https://projects.theforeman.org/issues/25143 from this bug

Comment 9 Andrew Kofink 2018-10-08 14:42:03 UTC
*** Bug 1573193 has been marked as a duplicate of this bug. ***

Comment 10 Satellite Program 2018-10-15 14:03:04 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue https://projects.theforeman.org/issues/25143 has been resolved.

Comment 13 Lai 2019-01-15 15:22:15 UTC
Steps to test:

1. Create a content-view and publish
2. Create a composite view and add content-view to composite view but don't publish
3. GET /katello/api/v2/content_view_versions/2
4. Look for the id
5. Publish the composite view
6. GET /katello/api/v2/content_view_versions/2

Actual Results
---------------
Step 3 GET:
{
    "version": "1.0",
    "major": 1,
    "minor": 0,
    "composite_content_view_ids": [],
    "published_in_composite_content_view_ids": [],
    "content_view_id": 3,
    "default": false,{
    "version": "1.0",
    "major": 1,
    "minor": 0,
    "composite_content_view_ids": [],
    "published_in_composite_content_view_ids": [],
    "content_view_id": 3,
    "default": false,
    "description": null,
    "package_count": 1022,
    "module_stream_count": 0,
    "srpm_count": 0,
    "file_count": 0,
    "package_group_count": 0,
    "puppet_module_count": 0,
    "docker_manifest_count": 0,
    "docker_manifest_list_count": 0,
    "docker_tag_count": 0,
    "ostree_branch_count": 0,
    "deb_count": 0,
    "id": 2,
    "name": "content-view-testing 1.0",
    "created_at": "2019-01-15 14:50:34 UTC",
    "updated_at": "2019-01-15 14:50:34 UTC",
    "content_view": {
        "id": 3,
        "name": "content-view-testing",
        "label": "content-view-testing"
    },
    "composite_content_views": [],
    "composite_content_view_versions": [],
    "published_in_composite_content_views": [],
    "environments": [
    "description": null,
    "package_count": 1022,
    "module_stream_count": 0,
    "srpm_count": 0,
    "file_count": 0,
    "package_group_count": 0,
    "puppet_module_count": 0,
    "docker_manifest_count": 0,
    "docker_manifest_list_count": 0,
    "docker_tag_count": 0,
    "ostree_branch_count": 0,
    "deb_count": 0,
    "id": 2,
    "name": "content-view-testing 1.0",
    "created_at": "2019-01-15 14:50:34 UTC",
    "updated_at": "2019-01-15 14:50:34 UTC",
    "content_view": {
        "id": 3,
        "name": "content-view-testing",
        "label": "content-view-testing"
    },
    "composite_content_views": [],
    "composite_content_view_versions": [],
    "published_in_composite_content_views": [],
    "environments": [

Step 6 GET:
{
    "version": "1.0",
    "major": 1,
    "minor": 0,
    "composite_content_view_ids": [],
    "published_in_composite_content_view_ids": [
        2
    ],
    "content_view_id": 3,
    "default": false,
    "description": null,
    "package_count": 1022,
    "module_stream_count": 0,
    "srpm_count": 0,
    "file_count": 0,
    "package_group_count": 0,
    "puppet_module_count": 0,
    "docker_manifest_count": 0,
    "docker_manifest_list_count": 0,
    "docker_tag_count": 0,
    "ostree_branch_count": 0,
    "deb_count": 0,
    "id": 2,
    "name": "content-view-testing 1.0",
    "created_at": "2019-01-15 14:50:34 UTC",
    "updated_at": "2019-01-15 14:50:34 UTC",
    "content_view": {
        "id": 3,
        "name": "content-view-testing",
        "label": "content-view-testing"
    },

In steps 6 you can see that the published_in_composite_content_view_ids has id 2 which came from step 3.  Thus verifying that the id is present once published.

Tested in 6.5.0 snap 11.

Comment 15 errata-xmlrpc 2019-05-14 12:37:00 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-2019:1222