Class: Y2Network::Autoinst::ConfigReader

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

Overview

This class is responsible of importing Autoyast configuration

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(section, original_config) ⇒ ConfigReader

Constructor


43
44
45
46
# File 'src/lib/y2network/autoinst/config_reader.rb', line 43

def initialize(section, original_config)
  @section = section
  @original_config = original_config
end

Instance Attribute Details

#sectionAutoinstProfile::NetworkingSection (readonly)


37
38
39
# File 'src/lib/y2network/autoinst/config_reader.rb', line 37

def section
  @section
end

Instance Method Details

#configY2Network::Config


49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'src/lib/y2network/autoinst/config_reader.rb', line 49

def config
  config = @original_config.copy
  # apply at first udev rules, so interfaces names are correct
  UdevRulesReader.new(section.udev_rules).apply(config) if section.udev_rules
  config.routing = RoutingReader.new(section.routing).config if section.routing
  config.dns = DNSReader.new(section.dns).config if section.dns
  if section.interfaces
    interfaces = InterfacesReader.new(section.interfaces).config
    interfaces.each do |interface|
      # add or update system configuration, this will also create all missing interfaces
      config.add_or_update_connection_config(interface)
    end
  end

  config
end