Class: Y2Network::Wicked::ConnectionConfigWriter
- Inherits:
-
Object
- Object
- Y2Network::Wicked::ConnectionConfigWriter
- Includes:
- Yast::Logger
- Defined in:
- src/lib/y2network/wicked/connection_config_writer.rb
Overview
This class is responsible for writing interfaces changes
Instance Method Summary collapse
-
#remove(conn) ⇒ Object
Removes connection config from the underlying system.
-
#write(conn, old_conn = nil) ⇒ Object
Writes connection config to the underlying system.
Instance Method Details
#remove(conn) ⇒ Object
Removes connection config from the underlying system
54 55 56 57 58 59 60 61 |
# File 'src/lib/y2network/wicked/connection_config_writer.rb', line 54 def remove(conn) ifcfg = CFA::InterfaceFile.find(conn.interface) ifcfg&.remove # During an autoinstallation do not remove /etc/hosts entries # associated with the static IP address (bsc#1173213). # The hook or original behavior was introduced because of (bsc#951330) Yast::Host.remove_ip(conn.ip.address.address.to_s) if !Yast::Mode.auto && conn.ip end |
#write(conn, old_conn = nil) ⇒ Object
Writes connection config to the underlying system
The method can receive the old configuration in order to perform clean-up tasks.
38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'src/lib/y2network/wicked/connection_config_writer.rb', line 38 def write(conn, old_conn = nil) return if conn == old_conn file = CFA::InterfaceFile.new(conn.interface) handler_class = find_handler_class(conn.type) return nil if handler_class.nil? file.clean remove(old_conn) if old_conn handler_class.new(file).write(conn) file.save end |