Class: Y2Network::AutoinstProfile::RoutingSection
- Inherits:
-
SectionWithAttributes
- Object
- SectionWithAttributes
- Y2Network::AutoinstProfile::RoutingSection
- Defined in:
- src/lib/y2network/autoinst_profile/routing_section.rb
Overview
This class represents an AutoYaST <routing> section under <networking>
<routing>
<ipv4_forward config:type="boolean">false</ipv4_forward>
<ipv6_forward config:type="boolean">false</ipv6_forward>
<routes config:type="list">
<route> <!-- see RouteSection class -->
<destination>192.168.1.0</destination>
<device>eth0</device>
<extrapara>foo</extrapara>
<gateway>-</gateway>
<netmask>-</netmask>
</route>
</routes>
</routing>
Instance Attribute Summary collapse
Attributes inherited from SectionWithAttributes
Class Method Summary collapse
- .attributes ⇒ Object
-
.new_from_network(routing) ⇒ RoutingSection
Clones network routing settings into an AutoYaST routing section.
Instance Method Summary collapse
-
#init_from_hashes(hash) ⇒ Object
Method used by SectionWithAttributes.new_from_hashes to populate the attributes when importing a profile.
-
#init_from_network(routing) ⇒ Boolean
Method used by RoutingSection.new_from_network to populate the attributes when cloning routing settings.
-
#initialize(*_args) ⇒ RoutingSection
constructor
Constructor.
Methods inherited from SectionWithAttributes
new_from_hashes, #section_name, #to_hashes
Constructor Details
#initialize(*_args) ⇒ RoutingSection
Constructor
73 74 75 76 |
# File 'src/lib/y2network/autoinst_profile/routing_section.rb', line 73 def initialize(*_args) super @routes = [] end |
Instance Attribute Details
#ipv4_forward ⇒ Boolean
|
# File 'src/lib/y2network/autoinst_profile/routing_section.rb', line 53
|
#ipv6_forward ⇒ Boolean
|
# File 'src/lib/y2network/autoinst_profile/routing_section.rb', line 56
|
#routes ⇒ Array<RouteSection>
|
# File 'src/lib/y2network/autoinst_profile/routing_section.rb', line 59
|
Class Method Details
.attributes ⇒ Object
43 44 45 46 47 48 49 |
# File 'src/lib/y2network/autoinst_profile/routing_section.rb', line 43 def self.attributes [ { name: :ipv4_forward }, { name: :ipv6_forward }, { name: :routes } ] end |
.new_from_network(routing) ⇒ RoutingSection
Clones network routing settings into an AutoYaST routing section
66 67 68 69 70 |
# File 'src/lib/y2network/autoinst_profile/routing_section.rb', line 66 def self.new_from_network(routing) result = new initialized = result.init_from_network(routing) 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 84 85 86 87 |
# File 'src/lib/y2network/autoinst_profile/routing_section.rb', line 81 def init_from_hashes(hash) super ip_forward = hash["ip_forward"] @ipv4_forward = hash["ipv4_forward"] || ip_forward @ipv6_forward = hash["ipv6_forward"] || ip_forward @routes = routes_from_hash(hash) end |
#init_from_network(routing) ⇒ Boolean
Method used by new_from_network to populate the attributes when cloning routing settings
93 94 95 96 97 98 |
# File 'src/lib/y2network/autoinst_profile/routing_section.rb', line 93 def init_from_network(routing) @ipv4_forward = routing.forward_ipv4 @ipv6_forward = routing.forward_ipv6 @routes = routes_section(routing.routes) true end |