Class: Y2Network::AutoinstProfile::UdevRulesSection

Inherits:
SectionWithAttributes show all
Includes:
Yast::Logger
Defined in:
src/lib/y2network/autoinst_profile/udev_rules_section.rb

Overview

This class represents an AutoYaST section under

Examples:

xml content

<net-udev config:type="list">
  <rule>
    <name>eth0</name>
    <rule>ATTR\{address\}</rule>
    <value>00:30:6E:08:EC:80</value>
  </rule>
</net-udev>

See Also:

Constant Summary

Constants inherited from SectionWithAttributes

SectionWithAttributes::VALUES_TO_SKIP

Instance Attribute Summary collapse

Attributes inherited from SectionWithAttributes

#parent

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from SectionWithAttributes

#attribute_key, #attribute_name, #attribute_scalar, #attribute_skip?, #attribute_value, #attributes, define_attr_accessors, #init_scalars_from_hash, new_from_hashes, #section_name, #to_hashes

Constructor Details

#initialize(*_args) ⇒ UdevRulesSection

Constructor


60
61
62
63
# File 'src/lib/y2network/autoinst_profile/udev_rules_section.rb', line 60

def initialize(*_args)
  super
  @udev_rules = []
end

Instance Attribute Details

#udev_rulesArray<UdevRuleSection>


# File 'src/lib/y2network/autoinst_profile/udev_rules_section.rb', line 48


Class Method Details

.attributesObject


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

def self.attributes
  [
    { name: :udev_rules, xml_name: :"net-udev" }
  ]
end

.new_from_network(interfaces) ⇒ UdevRulesSection

Clones network interfaces settings into an AutoYaST interfaces section


55
56
57
# File 'src/lib/y2network/autoinst_profile/udev_rules_section.rb', line 55

def self.new_from_network(interfaces)
  new.tap { |r| r.init_from_network(interfaces) }
end

Instance Method Details

#init_from_hashes(hash) ⇒ Object

Method used by SectionWithAttributes.new_from_hashes to populate the attributes when importing a profile


68
69
70
# File 'src/lib/y2network/autoinst_profile/udev_rules_section.rb', line 68

def init_from_hashes(hash)
  @udev_rules = udev_rules_from_hash(hash)
end

#init_from_network(interfaces) ⇒ Object

Method used by new_from_network to populate the attributes when cloning udev rules settings


75
76
77
# File 'src/lib/y2network/autoinst_profile/udev_rules_section.rb', line 75

def init_from_network(interfaces)
  @udev_rules = udev_rules_section(interfaces)
end