Class: Y2Network::DNS
- Inherits:
-
Object
- Object
- Y2Network::DNS
- Defined in:
- src/lib/y2network/dns.rb
Overview
DNS configuration (hostname, nameservers, etc.).
Instance Attribute Summary collapse
-
#dhcp_hostname ⇒ String, Symbol
Whether to take the hostname from DHCP.
-
#hostname ⇒ String
Hostname (local part).
-
#nameservers ⇒ Array<IPAddr>
List of nameservers.
-
#resolv_conf_policy ⇒ String
Resolv.conf update policy.
-
#searchlist ⇒ Array<String>
List of search domains.
Instance Method Summary collapse
-
#==(other) ⇒ Boolean
Determines whether two set of DNS settings are equal.
-
#initialize(opts = {}) ⇒ DNS
constructor
A new instance of DNS.
Constructor Details
#initialize(opts = {}) ⇒ DNS
TODO:
receive an array instead all these arguments
Returns a new instance of DNS.
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_hostname ⇒ String, Symbol
Returns Whether to take the hostname from DHCP. It can be an interface name (String), :any for any interface or :none from no taking the hostname from DHCP.
40 41 42 |
# File 'src/lib/y2network/dns.rb', line 40 def dhcp_hostname @dhcp_hostname end |
#hostname ⇒ String
Returns Hostname (local part).
26 27 28 |
# File 'src/lib/y2network/dns.rb', line 26 def hostname @hostname end |
#nameservers ⇒ Array<IPAddr>
Returns List of nameservers.
29 30 31 |
# File 'src/lib/y2network/dns.rb', line 29 def nameservers @nameservers end |
#resolv_conf_policy ⇒ String
Returns resolv.conf update policy.
35 36 37 |
# File 'src/lib/y2network/dns.rb', line 35 def resolv_conf_policy @resolv_conf_policy end |
#searchlist ⇒ Array<String>
Returns List of search domains.
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 |