Class: Y2Network::AutoinstProfile::DNSSection
- Inherits:
-
Installation::AutoinstProfile::SectionWithAttributes
- Object
- Installation::AutoinstProfile::SectionWithAttributes
- Y2Network::AutoinstProfile::DNSSection
- Defined in:
- src/lib/y2network/autoinst_profile/dns_section.rb
Overview
This class represents an AutoYaST
Instance Attribute Summary collapse
- #dhcp_hostname ⇒ Boolean
- #domain ⇒ String
- #hostname ⇒ String
- #nameservers ⇒ Array<String>
- #resolv_conf_policy ⇒ Array<String>
- #searchlist ⇒ Array<String>
Class Method Summary collapse
- .attributes ⇒ Object
-
.new_from_network(dns, hostname, parent = nil) ⇒ DNSSection
Clones network dns settings into an AutoYaST dns section.
Instance Method Summary collapse
-
#init_from_hashes(hash) ⇒ Object
Method used by new_from_hashes to populate the attributes when importing a profile.
-
#init_from_network(dns, hostname) ⇒ Boolean
Method used by DNSSection.new_from_network to populate the attributes when cloning DNS options.
-
#initialize(*_args) ⇒ DNSSection
constructor
Constructor.
Constructor Details
#initialize(*_args) ⇒ DNSSection
Constructor
85 86 87 88 89 |
# File 'src/lib/y2network/autoinst_profile/dns_section.rb', line 85 def initialize(*_args) super @nameservers = [] @searchlist = [] end |
Instance Attribute Details
#dhcp_hostname ⇒ Boolean
|
# File 'src/lib/y2network/autoinst_profile/dns_section.rb', line 52
|
#domain ⇒ String
|
# File 'src/lib/y2network/autoinst_profile/dns_section.rb', line 55
|
#hostname ⇒ String
|
# File 'src/lib/y2network/autoinst_profile/dns_section.rb', line 58
|
#nameservers ⇒ Array<String>
|
# File 'src/lib/y2network/autoinst_profile/dns_section.rb', line 61
|
#resolv_conf_policy ⇒ Array<String>
|
# File 'src/lib/y2network/autoinst_profile/dns_section.rb', line 64
|
#searchlist ⇒ Array<String>
|
# File 'src/lib/y2network/autoinst_profile/dns_section.rb', line 67
|
Class Method Details
.attributes ⇒ Object
40 41 42 43 44 45 46 47 48 |
# File 'src/lib/y2network/autoinst_profile/dns_section.rb', line 40 def self.attributes [ { name: :dhcp_hostname }, { name: :hostname }, { name: :nameservers }, { name: :resolv_conf_policy }, { name: :searchlist } ] end |
.new_from_network(dns, hostname, parent = nil) ⇒ DNSSection
Clones network dns settings into an AutoYaST dns section
NOTE: we need both DNS and Hostname settings because of historical reasons when both used to be handled in one class / module
78 79 80 81 82 |
# File 'src/lib/y2network/autoinst_profile/dns_section.rb', line 78 def self.new_from_network(dns, hostname, parent = nil) result = new(parent) initialized = result.init_from_network(dns, hostname) initialized ? result : nil end |
Instance Method Details
#init_from_hashes(hash) ⇒ Object
Method used by new_from_hashes to populate the attributes when importing a profile
94 95 96 97 98 |
# File 'src/lib/y2network/autoinst_profile/dns_section.rb', line 94 def init_from_hashes(hash) super @nameservers = hash["nameservers"] || [] @searchlist = hash["searchlist"] || [] end |
#init_from_network(dns, hostname) ⇒ Boolean
Method used by new_from_network to populate the attributes when cloning DNS options
106 107 108 109 110 111 112 113 |
# File 'src/lib/y2network/autoinst_profile/dns_section.rb', line 106 def init_from_network(dns, hostname) @dhcp_hostname = hostname.dhcp_hostname == :any @hostname = hostname.hostname @nameservers = dns.nameservers.map(&:to_s) @resolv_conf_policy = dns.resolv_conf_policy @searchlist = dns.searchlist true end |