Class: Y2Network::ConfigReader

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

Overview

This class is responsible for reading the configuration from the system

It implements a #read method which returns a configuration object containing the information from the corresponding backend.

It is expect that a configuration reader exists for each supported backend by inheriting from this class.

Direct Known Subclasses

Wicked::ConfigReader

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(_opts = {}) ⇒ ConfigReader

Returns a new instance of ConfigReader.



47
# File 'src/lib/y2network/config_reader.rb', line 47

def initialize(_opts = {}); end

Class Method Details

.for(source, *opts) ⇒ Y2Network::Autoinst::ConfigReader, Y2Network::Wicked::ConfigReader

Returns a configuration reader for a given source

Parameters:

  • source (Symbol)

    Source name (e.g., :wicked)

  • opts (Array<Object>)

    Reader options

Returns:



39
40
41
42
43
44
# File 'src/lib/y2network/config_reader.rb', line 39

def for(source, *opts)
  require "y2network/#{source}/config_reader"
  modname = source.to_s.split("_").map(&:capitalize).join
  klass = Y2Network.const_get("#{modname}::ConfigReader")
  klass.new(*opts)
end

Instance Method Details

#readY2Network::IssuesResult

Returns the configuration from the given backend

Returns:

Raises:

  • NotImplementedError



53
54
55
# File 'src/lib/y2network/config_reader.rb', line 53

def read
  raise NotImplementedError
end