Project

General

Profile

Bug #23458

content_view_versions is not showing correct data for composite_content_view_id

Added by Thomas McKay over 1 year ago. Updated about 1 year ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
-
Target version:
Difficulty:
Triaged:
Bugzilla link:
Pull request:
Fixed in Releases:
Found in Releases:

Description

Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=1573193

We are trying to delete one specific version of one CV from foreman.
The version ID is 234.
We expect the call
"""
https://server.example.com/katello/api/content_view_versions/234
"""
To show an array of composite content view in "composite_content_view_ids", for the CCV using this CV.

Here the code
"""
  1. curl -X GET -k -u admin:xxx -H "Accept: application/xml" https://server.example.com:443/katello/api/content_view_versions/234 {"version":"16.0","major":16,"minor":0,"composite_content_view_ids":[],"content_view_id":5,
    ""
Upon deletion,
  1. curl -X DELETE -k -u admin:xxx -H "Accept: application/xml" https://server.example.com:443/katello/api/content_view_versions/234 {"displayMessage":"Cannot delete version while it is in use by composite content views: RHEL7_Rolling_Capsule Version 10.0,RHEL7_Rolling Version 13.0","errors":["Cannot delete version while it is in use by composite content views: RHEL7_Rolling_Capsule Version 10.0,RHEL7_Rolling Version 13.0"]}

========

Is the creation of the composite_content_view_id array bugged or are we missing something?


Related issues

Is duplicate of Katello - Bug #25143: composite_content_view_ids field of a content_view_version is always emptyClosed

History

#1 Updated by Andrew Kofink over 1 year ago

  • Legacy Backlogs Release (now unused) set to 352
  • Assignee set to Thomas McKay
  • Subject changed from content_view_versions is not showing correct data for composite_content_view_id to content_view_versions is not showing correct data for composite_content_view_id

#2 Updated by Thomas McKay over 1 year ago

The content view version model never has any values in composite_content_views. Fetching id 8 of a composite content view version has empty list. This is the db at the time

katello=# select * from katello_content_view_components;
 id | content_view_version_id | composite_content_view_id |         created_at         |         updated_at         | content_view_id | latest 
----+-------------------------+---------------------------+----------------------------+----------------------------+-----------------+--------
  1 |                         |                         8 | 2018-04-30 13:48:49.614539 | 2018-04-30 13:48:49.614539 |               3 | t
  2 |                         |                         8 | 2018-04-30 13:48:49.62287  | 2018-04-30 13:48:49.62287  |               6 | t
(2 rows)

The UI doesn't rely on this field but instead makes a call to API which does return results as expected.

https://devel.example.com/katello/api/v2/content_view_versions?composite_version_id=8

#3 Updated by Thomas McKay over 1 year ago

This is the source line that I think should be joining the tables?
https://github.com/Katello/katello/blob/master/app/models/katello/content_view_version.rb#L28

    has_many :composite_content_views, :through => :content_view_components, :source => :composite_content_view

#4 Updated by Adam Ruzicka over 1 year ago

# cvv.composite_content_views goes through cvv.content_view_components
pry(main)> cvv.content_view_components.to_sql
=> "SELECT \"katello_content_view_components\".* FROM \"katello_content_view_components\" WHERE \"katello_content_view_components\".\"content_view_version_id\" = 4" 

As we can see in http://projects.theforeman.org/issues/23458#note-2, the components don't have the content_view_version_id attribute set.

#5 Updated by Andrew Kofink about 1 year ago

  • Is duplicate of Bug #25143: composite_content_view_ids field of a content_view_version is always empty added

#6 Updated by Andrew Kofink about 1 year ago

  • Status changed from New to Closed

Also available in: Atom PDF