Class: Y2Network::Sysconfig::ConnectionConfigWriters::Base

Inherits:
Object
  • Object
show all
Defined in:
src/lib/y2network/sysconfig/connection_config_writers/base.rb

Overview

This is the base class for connection config writers.

The derived classes should implement #update_file method.

Direct Known Subclasses

Bonding, Bridge, Ctc, Dummy, Ethernet, Hsi, Infiniband, Lcs, Qeth, Tap, Tun, Usb, Vlan, Wireless

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file) ⇒ Base

Constructor


35
36
37
# File 'src/lib/y2network/sysconfig/connection_config_writers/base.rb', line 35

def initialize(file)
  @file = file
end

Instance Attribute Details

#fileY2Network::Sysconfig::InterfaceFile (readonly)


30
31
32
# File 'src/lib/y2network/sysconfig/connection_config_writers/base.rb', line 30

def file
  @file
end

Instance Method Details

#write(conn) ⇒ Object

Writes connection information to the interface configuration file


42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'src/lib/y2network/sysconfig/connection_config_writers/base.rb', line 42

def write(conn)
  file.bootproto = conn.bootproto.name
  file.name = conn.description
  file.lladdr = conn.lladdress
  file.startmode = conn.startmode.to_s
  file.ifplugd_priority = conn.startmode.priority if conn.startmode.name == "ifplugd"
  if conn.ethtool_options && !conn.ethtool_options.empty?
    file.ethtool_options = conn.ethtool_options
  end
  file.zone = conn.firewall_zone
  add_ips(conn)
  update_file(conn)
  add_hostname(conn) if conn.bootproto.static?
end