Project

General

Profile

« Previous | Next » 

Revision 1b726d4f

Added by Greg Sutcliffe almost 10 years ago

Fixes #5941 - Handle nil comparison object in DHCP::Record.valid?

View differences:

lib/net/dhcp/record.rb
end
def == other
return false unless other.present?
if attrs[:hostname].blank?
# If we're converting an 'ad-hoc' lease created by a host booting outside of Foreman's knowledge,
# then :hostname will be blank on the incoming lease - if the ip/mac still match, then this
test/lib/net/dhcp_test.rb
"proxy" => subnets(:one).dhcp_proxy)
assert record1.conflicts.empty?
end
test "dhcp record validation should return false when proxy returns nil" do
ProxyAPI::DHCP.any_instance.stubs(:record).returns(nil)
record1 = Net::DHCP::Record.new(:hostname => "test1", :mac => "aa:bb:cc:dd:ee:ff",
:network => "127.0.0.0", :ip => "127.0.0.1",
"proxy" => subnets(:one).dhcp_proxy)
refute record1.valid?
end
end

Also available in: Unified diff