Class: Y2Network::Autoinst::DNSReader

Inherits:
Object
  • Object
show all
Defined in:
src/lib/y2network/autoinst/dns_reader.rb

Overview

This class is responsible of importing the AutoYast dns section

Constant Summary collapse

DEFAULT_RESOLV_CONF_POLICY =
"auto".freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(section) ⇒ DNSReader


36
37
38
# File 'src/lib/y2network/autoinst/dns_reader.rb', line 36

def initialize(section)
  @section = section
end

Instance Attribute Details

#sectionAutoinstProfile::DNSSection (readonly)


31
32
33
# File 'src/lib/y2network/autoinst/dns_reader.rb', line 31

def section
  @section
end

Instance Method Details

#configDNS

Creates a new DNS config from the imported profile dns section


43
44
45
46
47
48
49
50
51
# File 'src/lib/y2network/autoinst/dns_reader.rb', line 43

def config
  Y2Network::DNS.new(
    dhcp_hostname:      section.dhcp_hostname,
    hostname:           section.hostname || default_hostname,
    nameservers:        valid_ips(section.nameservers),
    resolv_conf_policy: section.resolv_conf_policy || DEFAULT_RESOLV_CONF_POLICY,
    searchlist:         section.searchlist
  )
end