Class: Y2Network::AutoinstProfile::NetworkingSection
- Inherits:
-
Installation::AutoinstProfile::SectionWithAttributes
- Object
- Installation::AutoinstProfile::SectionWithAttributes
- Y2Network::AutoinstProfile::NetworkingSection
- Defined in:
- src/lib/y2network/autoinst_profile/networking_section.rb
Overview
This class represents an AutoYaST <networking> section
Instance Attribute Summary collapse
- #backend ⇒ String
- #dns ⇒ DNSSection
- #interfaces ⇒ InterfacesSection
- #keep_install_network ⇒ Boolean
- #managed ⇒ Boolean
- #routing ⇒ RoutingSection
- #s390_devices ⇒ S390DevicesSection
- #setup_before_proposal ⇒ Boolean
- #start_immediately ⇒ Boolean
- #strict_ip_check_timeout ⇒ Boolean
- #udev_rules ⇒ UdevRulesSection
- #virt_bridge_proposal ⇒ Boolean
Class Method Summary collapse
- .attributes ⇒ Object
-
.new_from_hashes(hash) ⇒ NetworkingSection
Creates an instance based on the profile representation used by the AutoYaST modules (hash with nested hashes and arrays).
-
.new_from_network(config) ⇒ NetworkingSection
Creates an instance based on the network configuration representation.
Instance Method Summary collapse
-
#to_hashes ⇒ Hash
Export the section to a hash so it might be used when cloning the system.
Instance Attribute Details
#backend ⇒ String
|
# File 'src/lib/y2network/autoinst_profile/networking_section.rb', line 58
|
#interfaces ⇒ InterfacesSection
|
# File 'src/lib/y2network/autoinst_profile/networking_section.rb', line 58
|
#keep_install_network ⇒ Boolean
|
# File 'src/lib/y2network/autoinst_profile/networking_section.rb', line 58
|
#managed ⇒ Boolean
|
# File 'src/lib/y2network/autoinst_profile/networking_section.rb', line 58
|
#routing ⇒ RoutingSection
|
# File 'src/lib/y2network/autoinst_profile/networking_section.rb', line 58
|
#s390_devices ⇒ S390DevicesSection
|
# File 'src/lib/y2network/autoinst_profile/networking_section.rb', line 58
|
#setup_before_proposal ⇒ Boolean
|
# File 'src/lib/y2network/autoinst_profile/networking_section.rb', line 58
|
#start_immediately ⇒ Boolean
|
# File 'src/lib/y2network/autoinst_profile/networking_section.rb', line 58
|
#strict_ip_check_timeout ⇒ Boolean
|
# File 'src/lib/y2network/autoinst_profile/networking_section.rb', line 58
|
#udev_rules ⇒ UdevRulesSection
|
# File 'src/lib/y2network/autoinst_profile/networking_section.rb', line 58
|
#virt_bridge_proposal ⇒ Boolean
|
# File 'src/lib/y2network/autoinst_profile/networking_section.rb', line 58
|
Class Method Details
.attributes ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'src/lib/y2network/autoinst_profile/networking_section.rb', line 39 def self.attributes [ { name: :setup_before_proposal }, { name: :start_immediately }, { name: :keep_install_network }, { name: :virt_bridge_proposal }, { name: :strict_ip_check_timeout }, { name: :routing }, { name: :dns }, { name: :interfaces }, { name: :udev_rules }, { name: :s390_devices }, { name: :managed }, { name: :backend } ] end |
.new_from_hashes(hash) ⇒ NetworkingSection
Creates an instance based on the profile representation used by the AutoYaST modules (hash with nested hashes and arrays).
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'src/lib/y2network/autoinst_profile/networking_section.rb', line 88 def self.new_from_hashes(hash) result = new result.backend = hash["backend"] result.managed = hash["managed"] result.setup_before_proposal = hash["setup_before_proposal"] result.start_immediately = hash["start_immediately"] result.keep_install_network = hash["keep_install_network"] result.virt_bridge_proposal = hash["virt_bridge_proposal"] result.strict_ip_check_timeout = hash["strict_ip_check_timeout"] result.routing = RoutingSection.new_from_hashes(hash["routing"], result) if hash["routing"] result.dns = DNSSection.new_from_hashes(hash["dns"], result) if hash["dns"] if hash["interfaces"] result.interfaces = InterfacesSection.new_from_hashes(hash["interfaces"], result) end if hash["net-udev"] result.udev_rules = UdevRulesSection.new_from_hashes(hash["net-udev"], result) end if hash["s390-devices"] result.s390_devices = S390DevicesSection.new_from_hashes(hash["s390-devices"], result) end result end |
.new_from_network(config) ⇒ NetworkingSection
Creates an instance based on the network configuration representation
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 |
# File 'src/lib/y2network/autoinst_profile/networking_section.rb', line 115 def self.new_from_network(config) result = new return result unless config result.managed = config.backend?(:network_manager) result.backend = config.backend&.id.to_s if config.backend build_dns = config.dns || config.hostname result.routing = RoutingSection.new_from_network(config.routing) if config.routing result.dns = DNSSection.new_from_network(config.dns, config.hostname) if build_dns result.interfaces = InterfacesSection.new_from_network(config.connections, result) result.udev_rules = UdevRulesSection.new_from_network(config.interfaces) result.s390_devices = S390DevicesSection.new_from_network(config.connections) result end |
Instance Method Details
#to_hashes ⇒ Hash
Export the section to a hash so it might be used when cloning the system
134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 |
# File 'src/lib/y2network/autoinst_profile/networking_section.rb', line 134 def to_hashes result = {} result["dns"] = dns&.to_hashes || {} unless managed result["routing"] = routing&.to_hashes || {} result["net-udev"] = udev_rules&.udev_rules&.map(&:to_hashes) || [] result["interfaces"] = interfaces&.interfaces&.map(&:to_hashes) || [] result["s390-devices"] = s390_devices&.to_hashes&.fetch("devices", []) || [] end result.keys.each { |k| result.delete(k) if result[k].empty? } result["managed"] = true if managed result["backend"] = backend if backend result end |