Project

General

Profile

Actions

Bug #39257

closed

Hosts end up with a nil content source when registered to a foremanctl setup

Added by Jeremy Lenz 3 months ago. Updated 2 months ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Hosts
Target version:
Difficulty:
Triaged:
Yes
Fixed in Releases:
Found in Releases:

Description

When registering a host, Katello finds and sets the content source id. This is done via a method:

def get_content_source_id(hostname)
  proxies = SmartProxy.unscoped.authorized.filter do |sp|
    hostname == URI.parse(sp.url).hostname
  end
  return nil if proxies.length != 1
  proxies.first.id
end

Actual behavior

Problem is that in foremanctl setups,

[26] pry(main)> proxies = SmartProxy.unscoped.authorized.filter do |sp|
  hostname == URI.parse(sp.url).hostname
end.map(&:name)
=> ["satellite.example.com-pulp", "satellite.example.com-dev"]

there are two or more valid Smart Proxies whose hostname matches, causing

return nil if proxies.length != 1

to leave the host with a nil content source.

Expected behavior

We need to adjust this check to < 1.

Additionally, the -pulp and -dev smart proxies may have different hostnames. For this and other reasons, we should not rely on the name or hostname to find the correct smart proxy. Rather, we should use SmartProxy.with_feature('pulp')

Actions #1

Updated by The Foreman Bot 3 months ago

  • Status changed from New to Ready For Testing
  • Assignee set to Jeremy Lenz
  • Pull request https://github.com/Katello/katello/pull/11716 added
Actions #2

Updated by The Foreman Bot 3 months ago

  • Fixed in Releases Katello 4.21.0 added
Actions #3

Updated by Jeremy Lenz 3 months ago

  • Status changed from Ready For Testing to Closed
Actions #4

Updated by Ian Ballou 2 months ago

  • Target version set to Katello 4.21.0
  • Triaged changed from No to Yes
Actions

Also available in: Atom PDF