Class: Y2Network::DNS

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

Overview

DNS configuration (hostname, nameservers, etc.).

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ DNS

TODO:

receive an array instead all these arguments

Returns a new instance of DNS

Options Hash (opts):

  • :hostname (String)
  • :nameservers (Array<String>)
  • :searchlist (Array<String>)
  • :resolv_conf_policy (ResolvConfPolicy)
  • :dhcp_hostname (Boolean)

50
51
52
53
54
55
56
# File 'src/lib/y2network/dns.rb', line 50

def initialize(opts = {})
  @hostname = opts[:hostname]
  @nameservers = opts[:nameservers] || []
  @searchlist = opts[:searchlist] || []
  @resolv_conf_policy = opts[:resolv_conf_policy]
  @dhcp_hostname = opts[:dhcp_hostname]
end

Instance Attribute Details

#dhcp_hostnameString, Symbol


40
41
42
# File 'src/lib/y2network/dns.rb', line 40

def dhcp_hostname
  @dhcp_hostname
end

#hostnameString


26
27
28
# File 'src/lib/y2network/dns.rb', line 26

def hostname
  @hostname
end

#nameserversArray<IPAddr>


29
30
31
# File 'src/lib/y2network/dns.rb', line 29

def nameservers
  @nameservers
end

#resolv_conf_policyString


35
36
37
# File 'src/lib/y2network/dns.rb', line 35

def resolv_conf_policy
  @resolv_conf_policy
end

#searchlistArray<String>


32
33
34
# File 'src/lib/y2network/dns.rb', line 32

def searchlist
  @searchlist
end

Instance Method Details

#==(other) ⇒ Boolean

Determines whether two set of DNS settings are equal


68
69
70
# File 'src/lib/y2network/dns.rb', line 68

def ==(other)
  ATTRS.all? { |a| public_send(a) == other.public_send(a) }
end