Class: Y2Network::Sysconfig::ConfigReader

Inherits:
Object
  • Object
show all
Includes:
Y2Network::SysconfigPaths, Yast::Logger
Defined in:
src/lib/y2network/sysconfig/config_reader.rb

Overview

This class reads the current configuration from /etc/sysconfig files

Constant Summary

Constants included from Y2Network::SysconfigPaths

Y2Network::SysconfigPaths::SYSCTL_AGENT_PATH, Y2Network::SysconfigPaths::SYSCTL_IPV4_PATH, Y2Network::SysconfigPaths::SYSCTL_IPV6_PATH

Instance Method Summary collapse

Constructor Details

#initialize(_opts = {}) ⇒ ConfigReader

Returns a new instance of ConfigReader


40
41
# File 'src/lib/y2network/sysconfig/config_reader.rb', line 40

def initialize(_opts = {})
end

Instance Method Details

#configY2Network::Config

Returns Network configuration

Returns:


44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'src/lib/y2network/sysconfig/config_reader.rb', line 44

def config
  # NOTE: This code might be moved outside of the Sysconfig namespace, as it is generic.
  Yast::Host.Read

  routing_tables = find_routing_tables(interfaces_reader.interfaces)
  routing = Routing.new(
    tables:       routing_tables,
    forward_ipv4: sysctl_file.forward_ipv4?,
    forward_ipv6: sysctl_file.forward_ipv6?
  )

  result = Config.new(
    interfaces:  interfaces_reader.interfaces,
    connections: interfaces_reader.connections,
    drivers:     interfaces_reader.drivers,
    routing:     routing,
    dns:         dns,
    source:      :sysconfig
  )

  log.info "Sysconfig reader result: #{result.inspect}"
  result
end