Sha256: e75bb8907759f0a2e1c9318caa55cdc53c2d49ce637050bd14743233c77848bd

Contents?: true

Size: 984 Bytes

Versions: 5

Compression:

Stored size: 984 Bytes

Contents

module Nic
  class Bootable < Managed

    delegate :tftp?, :tftp, :to => :subnet
    delegate :jumpstart?, :build?, :to => :host

    # ensure that we can only have one bootable interface
    validates_uniqueness_of :type, :scope => :host_id, :message => N_("Only one bootable interface is allowed")

    def dhcp_record
      return unless dhcp? or @dhcp_record
      @dhcp_record ||= host.jumpstart? ? Net::DHCP::SparcRecord.new(dhcp_attrs) : Net::DHCP::Record.new(dhcp_attrs)
    end

    protected

    def dhcp_attrs
      attrs = super.merge({
                            :filename   => host.operatingsystem.boot_filename(host),
                            :nextServer => boot_server
                          })
      # Are we booting SPARC solaris?
      if host.jumpstart?
        jumpstart_arguments = host.os.jumpstart_params host, host.model.vendor_class
        attrs.merge! jumpstart_arguments unless jumpstart_arguments.empty?
      end
      attrs
    end

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
foreman_discovery-1.0.0 test/foreman_app/app/models/nic/bootable.rb
foreman_discovery-1.0.0.rc4 test/foreman_app/app/models/nic/bootable.rb
foreman_discovery-1.0.0.rc3 test/foreman_app/app/models/nic/bootable.rb
foreman_discovery-1.0.0.rc2 test/foreman_app/app/models/nic/bootable.rb
foreman_discovery-1.0.0.rc1 test/foreman_app/app/models/nic/bootable.rb