From 464022190d3cbd1074dfc1f6b4ed41f3e079f9e6 Mon Sep 17 00:00:00 2001 From: Evgeni Golov Date: Fri, 16 Aug 2024 10:17:38 +0200 Subject: [PATCH] Refs #37696 - only create sub-facet for c2r hosts We do have hosts that have no subscription facet, and should not have one. Adjust the logic for the c2r fact to only create the missing facet if the fact was sent, and leave hosts w/o the facet and w/o the fact alone. --- app/models/katello/host/subscription_facet.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/models/katello/host/subscription_facet.rb b/app/models/katello/host/subscription_facet.rb index a9cf4d30697..7ee14bd62a8 100644 --- a/app/models/katello/host/subscription_facet.rb +++ b/app/models/katello/host/subscription_facet.rb @@ -299,6 +299,7 @@ def backend_update_needed? def self.populate_fields_from_facts(host, parser, _type, _source_proxy) has_convert2rhel = parser.facts.key?('conversions.env.CONVERT2RHEL_THROUGH_FOREMAN') + return unless host.subscription_facet || has_convert2rhel # Add in custom convert2rhel fact if system was converted using convert2rhel through Katello # We want the value nil unless the custom fact is present otherwise we get a 0 in the database which if debugging # might make you think it was converted2rhel but not with satellite, that is why I have the tenary below.