diff --git a/app/models/foreman_uuid_boot/uuidboot_host_facet.rb b/app/models/foreman_uuid_boot/uuidboot_host_facet.rb index 202a0038960a25b2f73a1496135f28dd696c7690..79756b7c0d8d034208369388468220a02cea0d16 100644 --- a/app/models/foreman_uuid_boot/uuidboot_host_facet.rb +++ b/app/models/foreman_uuid_boot/uuidboot_host_facet.rb @@ -7,7 +7,8 @@ module ForemanUuidBoot def self.populate_fields_from_facts(host, parser, _type, _proxy) facet = host.uuidboot_facet || host.build_uuidboot_facet facet.uuid = parser.facts.dig('dmi', 'product', 'uuid') || parser.facts['uuid'] - facet.save if facet.changed? + facet.save if facet.uuid && facet.changed? + facet.destroy if !facet.uuid && facet.persisted? end end end