diff --git a/app/services/foreman/unattended_installation/concerns/host_finder_extensions.rb b/app/services/foreman/unattended_installation/concerns/host_finder_extensions.rb index 01a31930a52adf7a32f792be9ec7474dd1ed12b4..4abd4395dd8decef985de660099ab91486c0f9b5 100644 --- a/app/services/foreman/unattended_installation/concerns/host_finder_extensions.rb +++ b/app/services/foreman/unattended_installation/concerns/host_finder_extensions.rb @@ -13,11 +13,11 @@ module HostFinderExtensions def find_host_by_uuid return unless (uuid = query_params['uuid']) - facet = ForemanUuidBoot::UuidbootHostFacet.where(uuid: uuid).order(:created_at) - if facet.any? - Rails.logger.warn("Multiple hosts found with #{uuid}, picking up the most recent") if facet.count > 1 + facets = ForemanUuidBoot::UuidbootHostFacet.where(uuid: uuid).order(:created_at) + if facets.any? + Rails.logger.warn("Multiple hosts found with #{uuid}, picking up the most recent") if facets.count > 1 - return facet.last.host.reload + return facets.last.host.reload end # Fallback fact search