Skip to content

Commit

Permalink
Merge branch 'master' of github.com:yast/yast-network into sshd_enabl…
Browse files Browse the repository at this point in the history
…ement

Conflicts:
	package/yast2-network.changes
	package/yast2-network.spec
  • Loading branch information
jreidinger committed Apr 2, 2014
2 parents f7a99c0 + 29e3456 commit f3517d2
Show file tree
Hide file tree
Showing 14 changed files with 296 additions and 143 deletions.
52 changes: 52 additions & 0 deletions package/yast2-network.changes
Expand Up @@ -3,6 +3,58 @@ Wed Apr 2 09:22:07 UTC 2014 - jreidinger@suse.com

- split enabling sshd and opening firewall port in installation
(bnc#865056)
- 3.1.42

-------------------------------------------------------------------
Mon Mar 31 08:53:01 CEST 2014 - locilka@suse.com

- Fixed calling logging function in inst_lan (bnc#871091)
- 3.1.41

-------------------------------------------------------------------
Fri Mar 28 12:12:58 UTC 2014 - mfilka@suse.com

- bnc#870622
- opening network configuration dialogue on user's request works
- 3.1.40

-------------------------------------------------------------------
Thu Mar 27 08:11:59 UTC 2014 - mfilka@suse.com

- bnc#869776
- fixed internal error raised when building interface overview
- 3.1.39

-------------------------------------------------------------------
Mon Mar 24 23:18:43 UTC 2014 - mfilka@suse.com

- bnc#869353
- inst_lan can walk back in installer
- 3.1.38

-------------------------------------------------------------------
Fri Mar 21 15:24:19 UTC 2014 - mfilka@suse.com

- bnc#869224
- enlarged nic name input field in "Edit Nic Name" dialogue in
ncurses mode
- 3.1.37

-------------------------------------------------------------------
Wed Mar 19 09:53:20 UTC 2014 - mfilka@suse.com

- bnc#868830
- remove device also from LanItems' cache when deleting during
automatic configuration in installer
- 3.1.36

-------------------------------------------------------------------
Mon Mar 17 10:54:05 UTC 2014 - mfilka@suse.com

- gh#yast/yast-core#74
- automatic dhcp configuration is unable to clear unused
configurations. It blocks starting manual configuration dialog.
>>>>>>> 29e3456fde95c557b4712046d2d99d3a4290fde4
- 3.1.35

-------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion package/yast2-network.spec
Expand Up @@ -17,7 +17,7 @@


Name: yast2-network
Version: 3.1.35
Version: 3.1.42
Release: 0

BuildRoot: %{_tmppath}/%{name}-%{version}-build
Expand Down
18 changes: 15 additions & 3 deletions src/clients/inst_lan.rb
Expand Up @@ -38,6 +38,7 @@ def main
Yast.import "Label"
Yast.import "Lan"
Yast.import "RichText"
Yast.import "GetInstArgs"

textdomain "network"

Expand All @@ -47,11 +48,22 @@ def main
Yast.include self, "network/lan/cmdline.rb"
Yast.include self, "network/lan/wizards.rb"

conf_net = LanItems.Items.keys.any? { |i| LanItems.IsItemConfigured(i) }
manual_conf_request = GetInstArgs.argmap["skip_detection"] || false
log.info("Lan module forces manual configuration: #{manual_conf_request}")

log.info("Configured network found: #{conf_net}")
# keep network configuration state in @@conf_net to gurantee same
# behavior when walking :back in installation workflow
if !defined?(@@network_configured)
@@network_configured = LanItems.Items.keys.any? { |i| LanItems.IsItemConfigured(i) }
end

ret = !conf_net ? LanSequence() : :next
log.info("Configured network found: #{@@network_configured}")

if @@network_configured && !manual_conf_request
ret = GetInstArgs.going_back ? :back : :next
else
ret = LanSequence()
end

log.info("Lan module finished, ret = #{ret}")
log.info("----------------------------------------")
Expand Down
7 changes: 5 additions & 2 deletions src/clients/inst_setup_dhcp.rb
Expand Up @@ -47,7 +47,7 @@ def self.reload_config(card)
end

def self.delete_config(devname)
NetworkInterfaces.Delete2(devname)
LanItems.delete_dev(devname)
end

def self.write_configuration
Expand Down Expand Up @@ -84,10 +84,13 @@ def self.active_config?(devname)
log.info "Candidates for enabling DHCP: #{dhcp_cards}"

# TODO time consuming, some progress would be nice
dhcp_cards.each { |d| setup_dhcp(d) }
dhcp_cards.each { |d| setup_dhcp(d) }

activate_changes(dhcp_cards)

# workaround for gh#yast/yast-core#74 (https://github.com/yast/yast-core/issues/74)
NetworkInterfaces.CleanCacheRead()

# drop devices without dhcp lease
inactive_devices = dhcp_cards.select { |c| ! active_config?(c) }
log.info "Inactive devices: #{inactive_devices}"
Expand Down
96 changes: 20 additions & 76 deletions src/lib/network/confirm_virt_proposal.rb
Expand Up @@ -4,91 +4,35 @@

module Yast

Yast.import "UI"
Yast.import "LanItems"
Yast.import "Popup"

# The class represents a simple dialog which asks user for confirmation of
# network.service restart during installation.
class ConfirmVirtProposal

include Singleton
include UIShortcuts
include I18n

def self.run
open

# for autoinstallation popup has timeout 10 seconds (#192181)
# timeout for every case (bnc#429562)
ret = UI.TimeoutUserInput(10 * 1000)

close

ret
end

private

def self.open
UI.OpenDialog(
Opt(:decorated),
HBox(
HSpacing(1),
HCenter(
HSquash(
VBox(
HCenter(
HSquash(
VBox(
# This is the heading of the popup box
Left(Heading(_("Confirm Network Restart"))),
VSpacing(0.5),
# This is in information message. Next come the
# hardware class name (network cards).
HVCenter(
Label(
_(
"Because of the bridged network, YaST2 needs to restart the network to apply the settings."
)
)
),
VSpacing(0.5)
)
)
),
ButtonBox(
HWeight(
1,
PushButton(
Id(:ok),
Opt(:default, :okButton),
Label.OKButton
)
),
# PushButton label
HWeight(
1,
PushButton(
Id(:cancel),
Opt(:cancelButton),
Label.CancelButton
)
)
),
VSpacing(0.2)
)
)
),
HSpacing(1)
)
Yast.import "Popup"
Yast.import "Label"

# Shows a confirmation timed dialogue
#
# Returns :ok when user agreed, :cancel otherwise
def run
textdomain "network"

ret = Popup.TimedAnyQuestion(
_("Confirm Network Restart"),
_(
"Because of the bridged network, YaST2 needs to restart the network to apply the settings."
),
Label.OKButton,
Label.CancelButton,
:focus_yes,
10
)

UI.SetFocus(Id(:ok))
ret ? :ok : :cancel
end

def self.close
UI.CloseDialog
end

end
end
2 changes: 1 addition & 1 deletion src/lib/network/edit_nic_name.rb
Expand Up @@ -95,7 +95,7 @@ def open
Left(
HBox(
Label(_("Device name:")),
InputField(Id(:dev_name), "", @old_name)
InputField(Id(:dev_name), Opt(:hstretch), "", @old_name)
)
),
VSpacing(0.5),
Expand Down
2 changes: 1 addition & 1 deletion src/modules/Lan.rb
Expand Up @@ -641,7 +641,7 @@ def Write
if Stage.cont && @virt_net_proposal == true &&
(Linuxrc.usessh || Linuxrc.vnc || Linuxrc.display_ip)

if ConfirmVirtProposal.run == :ok
if ConfirmVirtProposal.instance.run == :ok
Builtins.y2milestone(
"Restarting network because of bridged proposal"
)
Expand Down
90 changes: 44 additions & 46 deletions src/modules/LanItems.rb
Expand Up @@ -497,14 +497,21 @@ def SetItemUdev(rule_key, rule_val)
# Updates device name.
#
# It updates device's udev rules and config name.
# Updating config name means that old configuration is deleted from
# the system.
#
# Returns new name
def SetItemName( itemId, name)
SetItemUdev("NAME", name)
if name && !name.empty?
SetItemUdev("NAME", name)
else
# rewrite rule for empty name is meaningless
@Items[itemId].delete("udev")
end

if @Items[ itemId].has_key?( "ifcfg")
NetworkInterfaces.Delete2( @Items[ itemId][ "ifcfg"])
@Items[ itemId][ "ifcfg"] = name
@Items[ itemId][ "ifcfg"] = name.to_s
end

name
Expand All @@ -513,6 +520,8 @@ def SetItemName( itemId, name)
# Updates current device name.
#
# It updates device's udev rules and config name.
# Updating config name means that old configuration is deleted from
# the system.
#
# Returns new name
def SetCurrentName( name)
Expand Down Expand Up @@ -848,25 +857,13 @@ def GetNetcardNames

# get list of all configurations for "netcard" macro in NetworkInterfaces module
def getNetworkInterfaces
confs = []
configurations = NetworkInterfaces.FilterDevices("netcard")
devtypes = NetworkInterfaces.CardRegex["netcard"].to_s.split("|")

Builtins.foreach(
Builtins.splitstring(
Ops.get(NetworkInterfaces.CardRegex, "netcard", ""),
"|"
)
) do |devtype|
Builtins.foreach(
Convert.convert(
Map.Keys(Ops.get_map(configurations, devtype, {})),
:from => "list",
:to => "list <string>"
)
) { |file| confs = Builtins.add(confs, file) }
devtypes.inject([]) do |acc, type|
conf = configurations[type].to_h
acc.concat(conf.keys)
end

deep_copy(confs)
end

def FindAndSelect(device)
Expand Down Expand Up @@ -1276,7 +1273,7 @@ def BuildLanOverview
IsEmpty(NetworkInterfaces.Current["WIRELESS_KEY_0"])

# avoid colons
ifcfg_name.tr!(":", "/")
ifcfg_name = ifcfg_name.tr(":", "/")
href = "lan--wifi-encryption-" + ifcfg_name
# interface summary: WiFi without encryption
warning = HTML.Colorize(_("Warning: no encryption is used."), "red")
Expand Down Expand Up @@ -2235,38 +2232,39 @@ def FindMatchingDevice(interface)
deep_copy(tosel)
end

# Deletes item and its configuration
#
# Item for deletion is searched using device name
def delete_dev(name)
FindAndSelect(name)
DeleteItem()
end

# Deletes the {current} item and its configuration
def DeleteItem
Builtins.y2milestone("deleting ... %1", Ops.get_map(@Items, @current, {}))
ifcfg = Ops.get_string(@Items, [@current, "ifcfg"], "")
hwcfg = Ops.get_string(@Items, [@current, "hwcfg"], "")
return if @current < 0
return if @Items.nil? || @Items.empty?

log.info("DeleteItem: #{@Items[@current]}")

if IsNotEmpty(ifcfg)
NetworkInterfaces.Delete(ifcfg)
if IsCurrentConfigured()
SetCurrentName("")
NetworkInterfaces.Commit
Ops.set(@Items, [@current, "ifcfg"], "")
end
if !Ops.greater_than(
Builtins.size(Ops.get_map(@Items, [@current, "hwinfo"], {})),
0
)
tmp_items = {}
Builtins.foreach(@Items) do |key, value|
if key == @current
next
else
if Ops.less_than(key, @current)
Ops.set(tmp_items, key, Ops.get_map(@Items, key, {}))
else
Ops.set(
tmp_items,
Ops.subtract(key, 1),
Ops.get_map(@Items, key, {})
)
end
end
end
@Items = deep_copy(tmp_items)

current_item = @Items[@current]

if current_item["hwinfo"].nil? || current_item["hwinfo"].empty?
# size is always > 0 here and items are numbered 0, 1, ..., size -1
delete_index = @Items.size - 1

@Items[@current] = @Items[delete_index] if delete_index != @current
@Items.delete(delete_index)

# item was deleted, so original @current is invalid
@current = -1
end

SetModified()

nil
Expand Down

0 comments on commit f3517d2

Please sign in to comment.