Revision 73ef39f4
Added by Brad Buckingham almost 10 years ago
app/models/katello/glue/candlepin/consumer.rb | ||
---|---|---|
facts["network.hostname"]
|
||
end
|
||
|
||
# interface listings come in the form of
|
||
#
|
||
# net.interface.em1.ipv4_address
|
||
# net.interface.eth0.ipv4_broadcast
|
||
#
|
||
# there are multiple entries for each interface, but
|
||
# we only need the ipv4 address
|
||
def interfaces
|
||
interfaces = []
|
||
facts.keys.each do |key|
|
||
match = /net\.interface\.([^\.]*)/.match(key)
|
||
if !match.nil? && !match[1].nil?
|
||
interfaces << match[1]
|
||
end
|
||
end
|
||
interface_set = []
|
||
interfaces.uniq.each do |interface|
|
||
addr = facts["net.interface.#{interface}.ipv4_address"]
|
||
# older subman versions report .ipaddr
|
||
addr ||= facts["net.interface.#{interface}.ipaddr"]
|
||
interface_set << { :name => interface, :addr => addr } if !addr.nil?
|
||
end
|
||
interface_set
|
||
Katello::System.interfaces(facts)
|
||
end
|
||
|
||
def ip
|
||
... | ... | |
return consumers_attrs, created
|
||
end
|
||
|
||
# interface listings come in the form of
|
||
#
|
||
# net.interface.em1.ipv4_address
|
||
# net.interface.eth0.ipv4_broadcast
|
||
#
|
||
# there are multiple entries for each interface, but
|
||
# we only need the ipv4 and mac addresses
|
||
def interfaces(facts)
|
||
interfaces = []
|
||
facts.keys.each do |key|
|
||
match = /net\.interface\.([^\.]*)/.match(key)
|
||
if !match.nil? && !match[1].nil?
|
||
interfaces << match[1]
|
||
end
|
||
end
|
||
interface_set = []
|
||
interfaces.uniq.each do |interface|
|
||
addr = facts["net.interface.#{interface}.ipv4_address"]
|
||
# older subman versions report .ipaddr
|
||
addr ||= facts["net.interface.#{interface}.ipaddr"]
|
||
mac = facts["net.interface.#{interface}.mac_address"]
|
||
interface_set << { :name => interface, :addr => addr, :mac => mac } if !addr.nil? || !mac.nil?
|
||
end
|
||
interface_set
|
||
end
|
||
end
|
||
|
||
end
|
Also available in: Unified diff
fixes #7005 / BZ 1122736 - content host - change registration behavior with foreman host
This commit alters the behavior of registering a content host
(with or without an activation key) that is to be associated
with a foreman host to do the following:
1. identify the foreman host that this content host will be
associated with by both name and mac address (previously
it was only by name)
2. if the foreman host identified is already associated with a
content host, delete it and then create/associate a new one.
(This will avoid there becoming duplicate content hosts with
the same name.)