Class: Y2Network::AutoinstProfile::InterfacesSection
- Inherits:
-
Installation::AutoinstProfile::SectionWithAttributes
- Object
- Installation::AutoinstProfile::SectionWithAttributes
- Y2Network::AutoinstProfile::InterfacesSection
- Includes:
- Yast::Logger
- Defined in:
- src/lib/y2network/autoinst_profile/interfaces_section.rb
Overview
This class represents an AutoYaST
Instance Attribute Summary collapse
Class Method Summary collapse
- .attributes ⇒ Object
-
.new_from_network(config, parent = nil) ⇒ InterfacesSection
Clones network interfaces settings into an AutoYaST interfaces section.
Instance Method Summary collapse
-
#init_from_hashes(hash) ⇒ Object
Method used by new_from_hashes to populate the attributes when importing a profile.
-
#init_from_network(connection_configs) ⇒ Boolean
Method used by InterfacesSection.new_from_network to populate the attributes when cloning routing settings.
-
#initialize(*_args) ⇒ InterfacesSection
constructor
Constructor.
Constructor Details
#initialize(*_args) ⇒ InterfacesSection
Constructor
76 77 78 79 |
# File 'src/lib/y2network/autoinst_profile/interfaces_section.rb', line 76 def initialize(*_args) super @interfaces = [] end |
Instance Attribute Details
#interfaces ⇒ Array<InterfaceSection>
|
# File 'src/lib/y2network/autoinst_profile/interfaces_section.rb', line 60
|
Class Method Details
.attributes ⇒ Object
52 53 54 55 56 |
# File 'src/lib/y2network/autoinst_profile/interfaces_section.rb', line 52 def self.attributes [ { name: :interfaces } ] end |
.new_from_network(config, parent = nil) ⇒ InterfacesSection
Clones network interfaces settings into an AutoYaST interfaces section
69 70 71 72 73 |
# File 'src/lib/y2network/autoinst_profile/interfaces_section.rb', line 69 def self.new_from_network(config, parent = nil) result = new(parent) initialized = result.init_from_network(config) initialized ? result : nil end |
Instance Method Details
#init_from_hashes(hash) ⇒ Object
Method used by new_from_hashes to populate the attributes when importing a profile
84 85 86 87 88 |
# File 'src/lib/y2network/autoinst_profile/interfaces_section.rb', line 84 def init_from_hashes(hash) # we expect list of hashes here, remove everything else h = hash.delete_if { |v| !v.is_a?(Hash) } @interfaces = interfaces_from_hash(h) end |
#init_from_network(connection_configs) ⇒ Boolean
Method used by new_from_network to populate the attributes when cloning routing settings
94 95 96 97 |
# File 'src/lib/y2network/autoinst_profile/interfaces_section.rb', line 94 def init_from_network(connection_configs) @interfaces = interfaces_section(connection_configs) true end |