Project

General

Profile

« Previous | Next » 

Revision 4c091cd8

Added by Ohad Levy over 12 years ago

  • ID 4c091cd8bfb4efbdc116743109c0a30de2f97d90

fixes #1201 - Import Subnets from DHCP server

View differences:

app/models/subnet.rb
nil
end
# imports subnets from a dhcp smart proxy
def self.import proxy
return unless proxy.features.include?(Feature.find_by_name("DHCP"))
ProxyAPI::DHCP.new(:url => proxy.url).subnets.map do |s|
# do not import existing networks.
attrs = { :network => s["network"], :mask => s["netmask"] }
next if first(:conditions => attrs)
new(attrs.update(:dhcp => proxy))
end.compact
end
end

Also available in: Unified diff