Class: Y2Network::Autoinst::InterfacesReader
- Inherits:
-
Object
- Object
- Y2Network::Autoinst::InterfacesReader
- Includes:
- Yast::I18n, Yast::Logger
- Defined in:
- src/lib/y2network/autoinst/interfaces_reader.rb
Overview
This class is responsible of importing the AutoYast interfaces section
Instance Attribute Summary collapse
Instance Method Summary collapse
-
#config ⇒ ConnectionConfigsCollection
Creates a new ConnectionConfigsCollection config from the imported profile interfaces section.
-
#initialize(section) ⇒ InterfacesReader
constructor
A new instance of InterfacesReader.
Constructor Details
#initialize(section) ⇒ InterfacesReader
Returns a new instance of InterfacesReader.
39 40 41 42 43 |
# File 'src/lib/y2network/autoinst/interfaces_reader.rb', line 39 def initialize(section) textdomain "network" @section = section end |
Instance Attribute Details
#section ⇒ AutoinstProfile::InterfacesSection (readonly)
36 37 38 |
# File 'src/lib/y2network/autoinst/interfaces_reader.rb', line 36 def section @section end |
Instance Method Details
#config ⇒ ConnectionConfigsCollection
Note:
interfaces will be created automatic from connection configs
Creates a new ConnectionConfigsCollection config from the imported profile interfaces section
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'src/lib/y2network/autoinst/interfaces_reader.rb', line 50 def config configs = @section.interfaces.map do |interface_section| log.info "Creating config for interface section: #{interface_section.inspect}" config = create_config(interface_section) config.propose # propose reasonable defaults for not set attributes unless load_generic(config, interface_section) log.info "Skipping interface as the configuration was wrongly defined" next end case config when ConnectionConfig::Vlan load_vlan(config, interface_section) when ConnectionConfig::Bridge load_bridge(config, interface_section) when ConnectionConfig::Bonding load_bonding(config, interface_section) when ConnectionConfig::Wireless load_wireless(config, interface_section) end log.info "Resulting config: #{config.inspect}" config end ConnectionConfigsCollection.new(configs.compact) end |