Class: Y2Network::AutoinstProfile::InterfacesSection

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

Overview

This class represents an AutoYaST section under

dhcp eth0 auto static 127.255.255.255 lo no 127.0.0.1 255.0.0.0 127.0.0.0 8 nfsroot no

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) ⇒ InterfacesSection

Constructor


73
74
75
76
# File 'src/lib/y2network/autoinst_profile/interfaces_section.rb', line 73

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

Instance Attribute Details

#interfacesArray<InterfaceSection>


# File 'src/lib/y2network/autoinst_profile/interfaces_section.rb', line 59


Class Method Details

.attributesObject


51
52
53
54
55
# File 'src/lib/y2network/autoinst_profile/interfaces_section.rb', line 51

def self.attributes
  [
    { name: :interfaces }
  ]
end

.new_from_network(config) ⇒ InterfacesSection

Clones network interfaces settings into an AutoYaST interfaces section


66
67
68
69
70
# File 'src/lib/y2network/autoinst_profile/interfaces_section.rb', line 66

def self.new_from_network(config)
  result = new
  initialized = result.init_from_network(config)
  initialized ? result : nil
end

Instance Method Details

#init_from_hashes(hash) ⇒ Object

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


81
82
83
# File 'src/lib/y2network/autoinst_profile/interfaces_section.rb', line 81

def init_from_hashes(hash)
  @interfaces = interfaces_from_hash(hash)
end

#init_from_network(connection_configs) ⇒ Boolean

Method used by new_from_network to populate the attributes when cloning routing settings


89
90
91
92
# File 'src/lib/y2network/autoinst_profile/interfaces_section.rb', line 89

def init_from_network(connection_configs)
  @interfaces = interfaces_section(connection_configs)
  true
end