Class: Y2Network::Sysconfig::ConfigWriter

Inherits:
Object
  • Object
show all
Includes:
Y2Network::SysconfigPaths, Yast::Logger
Defined in:
src/lib/y2network/sysconfig/config_writer.rb

Overview

This class imports a configuration into YaST modules

Ideally, it should be responsible of writing the changes to the underlying system.

Constant Summary

Constants included from Y2Network::SysconfigPaths

Y2Network::SysconfigPaths::SYSCTL_AGENT_PATH, Y2Network::SysconfigPaths::SYSCTL_IPV4_PATH, Y2Network::SysconfigPaths::SYSCTL_IPV6_PATH

Instance Method Summary collapse

Instance Method Details

#write(config, old_config = nil) ⇒ Object

Writes the configuration into YaST network related modules


43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'src/lib/y2network/sysconfig/config_writer.rb', line 43

def write(config, old_config = nil)
  log.info "Writing configuration: #{config.inspect}"
  log.info "Old configuration: #{old_config.inspect}"
  write_ip_forwarding(config.routing) if config.routing
  write_interface_changes(config, old_config)

  # update /etc/sysconfig/network/routes file
  file = routes_file_for(nil)
  file.routes = find_routes_for(nil, config.routing.routes)
  file.save

  write_drivers(config.drivers)
  write_interfaces(config.interfaces)
  write_connections(config.connections, old_config)
  write_dns_settings(config, old_config)

  # NOTE: This code might be moved outside of the Sysconfig namespace, as it is generic.
  Yast::Host.Write(gui: false)
end