Bug #39503
closedCVEnvs displayed in wrong order in UI due to CVECF priorities not set during initial host registration
Description
Description of problem:
When a host is first registered with multiple content view environments, all CVECF records get priority: 0. The content_view_environments= setter calls reprioritize_for_content_facet
immediately after super, but for a new (unsaved) content facet, the CVECF join records only exist in memory — not in the database. Since reprioritize_for_content_facet uses find_by (a
database query), it finds nothing and sets no priorities. When content_facet.save! runs later in populate_content_facet, all CVECFs are persisted with the default priority of 0.
Fix: Call reprioritize_for_content_facet again in populate_content_facet after content_facet.save! when the content facet was a new record.
How reproducible:
100%
Is this issue a regression from an earlier version:
no? but not sure how we missed it
Steps to Reproduce:
Create an AK that assigns multiple CVEnvs
register a host
look at myhost.content_view_environment_content_facets
Actual behavior:
All CVECFs have a priority of 0
CVEnvs are displayed in a random order in Web UI
subscription-manager environments --list-enabled shows correct order.
Expected behavior:
Priority should be unique (0, 1, etc)
CVEnvs are displayed in Web UI in the same order as subscription-manager environments --list-enabled
Updated by The Foreman Bot 2 months ago
- Status changed from New to Ready For Testing
- Pull request https://github.com/Katello/katello/pull/11794 added
Updated by Anonymous 2 months ago
- Status changed from Ready For Testing to Closed
Applied in changeset katello|ed8b7e896ec09f5de0b03ce0c3d3c81686546ab2.
Updated by Ian Ballou 2 months ago
- Category set to Hosts
- Target version set to Katello 4.21.1
- Triaged changed from No to Yes
Updated by The Foreman Bot about 1 month ago
- Fixed in Releases Katello 4.21.1 added