Skip to content

Commit

Permalink
NetworkAY: dot not import in save_network, and write hosts if imported
Browse files Browse the repository at this point in the history
  • Loading branch information
teclator committed May 20, 2020
1 parent eccd125 commit 7618729
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions src/lib/network/network_autoyast.rb
Expand Up @@ -110,13 +110,9 @@ def set_network_service
# @return [Boolean] true when configuration was present and loaded from the profile
def configure_lan(write: false)
log.info("NetworkAutoYast: Lan configuration")
return false if Lan.autoinst.before_proposal

ay_configuration = Lan.FromAY(ay_networking_section)
if keep_net_config?
ay_configuration = NetworkAutoYast.instance.merge_configs(ay_configuration)
end

configure_submodule(Lan, ay_configuration, write: write)
result = Lan.WriteOnly
end

# Takes care of activate s390 devices from the profile declaration
Expand Down Expand Up @@ -154,6 +150,12 @@ def activate_s390_devices(section = nil)
def configure_hosts(write: false)
log.info("NetworkAutoYast: Hosts configuration")

unless ay_current_profile.key? "host"
Host.Write(gui: false)

return true
end

hosts_config = (ay_host_section["hosts"] || {}).map do |host|
# we need to guarantee order of the items here
[host["host_address"] || "", host["names"] || []]
Expand Down Expand Up @@ -310,10 +312,7 @@ def configure_submodule(yast_module, ay_config, write: false)
# Return true in order to not call the NetworkAutoconfiguration.configure_hosts
return true unless AutoInstall.valid_imported_values

mode_section = ay_general_section.fetch("mode", {})
write ||= !mode_section.fetch("second_stage", true)
log.info("Write configuration instantly: #{write}")

yast_module.Write(gui: false) if write

true
Expand Down

0 comments on commit 7618729

Please sign in to comment.