Bug #23458
closedcontent_view_versions is not showing correct data for composite_content_view_id
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.
"""
- 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,
""
- 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?
Updated by Andrew Kofink over 6 years ago
- 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
- Assignee set to Thomas McKay
- Translation missing: en.field_release set to 352
Updated by Thomas McKay over 6 years 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
Updated by Thomas McKay over 6 years 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
Updated by Adam Ruzicka over 6 years 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.
Updated by Andrew Kofink about 6 years ago
- Is duplicate of Bug #25143: composite_content_view_ids field of a content_view_version is always empty added
Updated by Andrew Kofink about 6 years ago
- Status changed from New to Closed
Applied in changeset katello|cd99f28a3270995ce607403b27f39124cc49d058.