Class: Y2Network::Autoinst::UdevRulesReader

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

Overview

This class is responsible of importing the AutoYast udev rules section It is a bit different than other readers as it does not produce its config, but instead it is applied on top of current config by applying proper names for interfaces or creating new ones.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(section) ⇒ UdevRulesReader

Returns a new instance of UdevRulesReader.

Parameters:

  • section (AutoinstProfile::UdevRulesSectionSection)


36
37
38
# File 'src/lib/y2network/autoinst/udev_rules_reader.rb', line 36

def initialize(section)
  @section = section
end

Instance Attribute Details

#sectionAutoinstProfile::UdevRulesSection (readonly)



33
34
35
# File 'src/lib/y2network/autoinst/udev_rules_reader.rb', line 33

def section
  @section
end

Instance Method Details

#apply(config) ⇒ Object

Apply udev rules on passed config

Parameters:



42
43
44
45
46
47
48
49
50
51
# File 'src/lib/y2network/autoinst/udev_rules_reader.rb', line 42

def apply(config)
  @section.udev_rules.each do |udev_rule|
    target_interface = interface_for(config, udev_rule)
    if target_interface
      rename_interface(config, target_interface, udev_rule)
    else
      create_interface(config, udev_rule)
    end
  end
end