Sha256: 37ee152a2f6006987c1806a345cf24a5055cb92802c516fe609ac8e3d096d981
Contents?: true
Size: 820 Bytes
Versions: 24
Compression:
Stored size: 820 Bytes
Contents
module ForemanDiscovery class SubnetSuggestion attr_accessor :ip, :kind def self.for(ip:, kind:) new(ip: ip, kind: kind).() end def initialize(ip:, kind:) self.ip = ip self.kind = kind end def call return unless ip begin subnet = Subnet.unscoped.subnet_for(ip) rescue Exception => e Rails.logger.error "Error while detecting subnet for IP #{ip}" Foreman::Logging.exception "Unable to detect subnet", e subnet = nil end if subnet Rails.logger.info "Detected #{kind} subnet: #{subnet} with taxonomy #{subnet.organizations.collect(&:name)}/#{subnet.locations.collect(&:name)}" else Rails.logger.info "#{kind} subnet could not be detected for #{ip}" end subnet end end end
Version data entries
24 entries across 24 versions & 1 rubygems