Class: Y2Network::Sysconfig::ConnectionConfigReaders::Base
- Inherits:
-
Object
- Object
- Y2Network::Sysconfig::ConnectionConfigReaders::Base
- Defined in:
- src/lib/y2network/sysconfig/connection_config_readers/base.rb
Overview
This is the base class for connection config readers.
The derived classes should implement #update_connection_config method. methods.
Direct Known Subclasses
Bonding, Bridge, Ctc, Dummy, Ethernet, Hsi, Infiniband, Lcs, Qeth, Tap, Tun, Usb, Vlan, Wireless
Instance Attribute Summary collapse
-
#file ⇒ Y2Network::Sysconfig::InterfaceFile
readonly
Interface's configuration file.
Instance Method Summary collapse
-
#connection_config ⇒ Y2Network::ConnectionConfig::Base
Builds a connection configuration object.
-
#initialize(file) ⇒ Base
constructor
Constructor.
Constructor Details
#initialize(file) ⇒ Base
Constructor
41 42 43 |
# File 'src/lib/y2network/sysconfig/connection_config_readers/base.rb', line 41 def initialize(file) @file = file end |
Instance Attribute Details
#file ⇒ Y2Network::Sysconfig::InterfaceFile (readonly)
Returns Interface's configuration file.
36 37 38 |
# File 'src/lib/y2network/sysconfig/connection_config_readers/base.rb', line 36 def file @file end |
Instance Method Details
#connection_config ⇒ Y2Network::ConnectionConfig::Base
Builds a connection configuration object
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'src/lib/y2network/sysconfig/connection_config_readers/base.rb', line 48 def connection_config connection_class.new.tap do |conn| conn.bootproto = BootProtocol.from_name(file.bootproto || "static") conn.description = file.name conn.interface = file.interface conn.ip = all_ips.find { |i| i.id.empty? } conn.ip_aliases = all_ips.reject { |i| i.id.empty? } conn.name = file.interface conn.lladdress = file.lladdr conn.startmode = Startmode.create(file.startmode || "manual") conn.startmode.priority = file.ifplugd_priority if conn.startmode.name == "ifplugd" conn. = file. conn.firewall_zone = file.zone conn.hostname = hostname(conn) update_connection_config(conn) end end |