Skip to content

Commit

Permalink
Perform explicit device activation in case of ssh install. bnc#993587
Browse files Browse the repository at this point in the history
  • Loading branch information
mchf committed Aug 24, 2016
1 parent f847f9a commit c058baf
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 16 deletions.
13 changes: 2 additions & 11 deletions src/lib/network/network_autoconfiguration.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
# encoding: utf-8

require "yast"
require "network/wicked_handlers"

module Yast
# The class is responsible for generating / proposing automatic
# configuration during installation workflow
class NetworkAutoconfiguration
include Wicked
include Singleton
include Logger
include Yast
Expand Down Expand Up @@ -142,17 +144,6 @@ def setup_dhcp(card)
LanItems.Commit
end

# Reloads configuration for each device named in devs
#
# @devs [Array] list of device names
# @return true if configuration was reloaded
def reload_config(devs)
raise ArgumentError if devs.nil?
return true if devs.empty?

SCR.Execute(BASH_PATH, "wicked ifreload #{devs.join(" ")}") == 0
end

def delete_config(devname)
LanItems.delete_dev(devname)
end
Expand Down
20 changes: 20 additions & 0 deletions src/lib/network/wicked_handlers.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# encoding: utf-8

require "yast"

module Yast
module Wicked
BASH_PATH = Path.new(".target.bash")

# Reloads configuration for each device named in devs
#
# @devs [Array] list of device names
# @return true if configuration was reloaded
def reload_config(devs)
raise ArgumentError if devs.nil?
return true if devs.empty?

SCR.Execute(BASH_PATH, "wicked ifreload #{devs.join(" ")}").zero?
end
end
end
22 changes: 17 additions & 5 deletions src/modules/Lan.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
# Input and output routines.
require "yast"
require "network/confirm_virt_proposal"
require "network/wicked_handlers"

module Yast
class LanClass < Module
Expand Down Expand Up @@ -1120,17 +1121,28 @@ def HaveXenBridge
private

def activate_network_service
if LanItems.force_restart
# If the second installation stage has been called by yast.ssh via
# ssh, we should not restart network because systemctl
# hangs in that case. (bnc#885640)
action = :reload_restart if Stage.normal || !Linuxrc.usessh
action = :force_restart if LanItems.force_restart
action = :remote_installer if Stage.initial && (Linuxrc.usessh || Linuxrc.vnc)

case action
when :force_restart
log.info("Network service activation forced")
NetworkService.Restart
else

when :reload_restart
log.info "Attempting to reload network service, normal stage " \
"#{Stage.normal}, ssh: #{Linuxrc.usessh}"

# If the second installation stage has been called by yast.ssh via
# ssh, we should not restart network cause systemctl
# hangs in that case. (bnc#885640)
NetworkService.ReloadOrRestart if Stage.normal || !Linuxrc.usessh

when :remote_installer
# last instance handling "special" cases like ssh installation
# FIXME: most probably not everything will be set properly
LanItems.reload_config(LanItems.GetAllInterfaces())
end
end
end
Expand Down
1 change: 1 addition & 0 deletions src/modules/LanItems.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ class LanItemsClass < Module
attr_accessor :ipoib_mode

include Logger
include Wicked

def main
Yast.import "UI"
Expand Down

0 comments on commit c058baf

Please sign in to comment.