Project

General

Profile

« Previous | Next » 

Revision fcc2b55d

Added by Lukas Zapletal almost 6 years ago

Fixes #23768 - keep_subnet flag to prevent subnet override (#5635)

View differences:

app/models/host/base.rb
iface.ip = attributes.delete(:ipaddress)
iface.ip6 = attributes.delete(:ipaddress6)
iface.ip6 = nil if (IPAddr.new('fe80::/10').include?(iface.ip6) rescue false)
keep_subnet = attributes.delete(:keep_subnet)
if Setting[:update_subnets_from_facts]
if Setting[:update_subnets_from_facts] && !keep_subnet
iface.subnet = Subnet.subnet_for(iface.ip) if iface.ip_changed? && !iface.matches_subnet?(:ip, :subnet)
iface.subnet6 = Subnet.subnet_for(iface.ip6) if iface.ip6_changed? && !iface.matches_subnet?(:ip6, :subnet6)
end

Also available in: Unified diff