Class: Y2Network::NetworkManager::ConnectionConfigWriters::Base
- Inherits:
-
Object
- Object
- Y2Network::NetworkManager::ConnectionConfigWriters::Base
- Defined in:
- src/lib/y2network/network_manager/connection_config_writers/base.rb
Overview
Base class for connection config writers.
The derived classes should implement a #update_file method.
Instance Attribute Summary collapse
-
#file ⇒ CFA::NmConnection
readonly
Connection configuration file.
Instance Method Summary collapse
-
#initialize(file) ⇒ Base
constructor
Constructor.
-
#write(conn, opts = {}) ⇒ Object
Writes connection information to the interface configuration file.
Constructor Details
#initialize(file) ⇒ Base
Constructor
36 37 38 |
# File 'src/lib/y2network/network_manager/connection_config_writers/base.rb', line 36 def initialize(file) @file = file end |
Instance Attribute Details
#file ⇒ CFA::NmConnection (readonly)
Returns Connection configuration file.
31 32 33 |
# File 'src/lib/y2network/network_manager/connection_config_writers/base.rb', line 31 def file @file end |
Instance Method Details
#write(conn, opts = {}) ⇒ Object
Writes connection information to the interface configuration file
48 49 50 51 52 53 54 55 56 57 58 |
# File 'src/lib/y2network/network_manager/connection_config_writers/base.rb', line 48 def write(conn, opts = {}) file.connection["id"] = conn.name file.connection["autoconnect"] = "false" if ["manual", "off"].include? conn.startmode.name file.connection["permissions"] = nil file.connection["interface-name"] = conn.interface file.connection["zone"] = conn.firewall_zone unless ["", nil].include? conn.firewall_zone conn.bootproto.dhcp? ? configure_dhcp(conn) : configure_ips(conn) configure_routes(opts[:routes] || []) configure_as_port(opts[:parent]) if opts[:parent] update_file(conn) end |