Sha256: 30211a40c4f8a88b7564000ab74a0e30599b937b3aef3c599e3af06830e5e7af
Contents?: true
Size: 1.55 KB
Versions: 5
Compression:
Stored size: 1.55 KB
Contents
module Nic class Managed < Interface include Orchestration include Orchestration::DHCP include Orchestration::DNS attr_accessible :name, :subnet_id, :subnet, :domain_id, :domain validates_uniqueness_of :name, :scope => :domain_id belongs_to :subnet belongs_to :domain delegate :vlanid, :network, :to => :subnet # Interface normally are not executed by them self, so we use the host queue and related methods. # this ensures our orchestration works on both a host and a managed interface delegate :progress_report_id, :require_ip_validation?, :overwrite?, :capabilities, :managed?, :to => :host # this ensures we can create an interface even when there is no host queue # e.g. outside to Host nested attributes def queue_with_host if host logger.debug 'Using host queue' host.queue else logger.debug 'Using nic queue' queue_without_host end end alias_method_chain :queue, :host # returns a DHCP reservation object def dhcp_record return unless dhcp? or @dhcp_record @dhcp_record ||= Net::DHCP::Record.new(dhcp_attrs) end protected def uniq_fields_with_hosts [:mac, :ip, :name] end # returns a hash of dhcp record attributes def dhcp_attrs raise ::Foreman::Exception.new(N_("DHCP not supported for this NIC")) unless dhcp? { :hostname => name, :ip => ip, :mac => mac, :proxy => subnet.dhcp_proxy, :network => network } end end end
Version data entries
5 entries across 5 versions & 1 rubygems