Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/SLE-12-GA'
Browse files Browse the repository at this point in the history
Conflicts:
	.travis.yml
	Rakefile
	package/yast2-network.changes
	package/yast2-network.spec
  • Loading branch information
lslezak committed Nov 18, 2014
2 parents eaaaeaa + 280741a commit 0c194af
Show file tree
Hide file tree
Showing 13 changed files with 190 additions and 21 deletions.
4 changes: 3 additions & 1 deletion .travis.yml
Expand Up @@ -5,8 +5,10 @@ before_install:
# disable rvm, use system Ruby
- rvm reset
- wget https://raw.githubusercontent.com/yast/yast-devtools/master/travis-tools/travis_setup.sh
- sh ./travis_setup.sh -p "yast2-devtools yast2-testsuite yast2 yast2-storage yast2-proxy yast2-country yast2-packager" -g rspec:2.14.1
- sh ./travis_setup.sh -p "rake yast2-devtools yast2-testsuite yast2 yast2-storage yast2-proxy yast2-country yast2-packager" -g "rspec:2.14.1 yast-rake gettext"
script:
- rake check:syntax
- rake check:pot
- make -f Makefile.cvs
- make
- sudo make install
Expand Down
37 changes: 37 additions & 0 deletions package/yast2-network.changes
@@ -1,3 +1,40 @@
-------------------------------------------------------------------
Fri Oct 17 07:45:24 UTC 2014 - mfilka@suse.com

- bnc#898250, bnc#899363
- ignore /etc/install.inf:usessh flag when the file is present in
installed system and always reload / restart network service in
case of updated configuration
- 3.1.109

-------------------------------------------------------------------
Thu Oct 10 17:10:42 CEST 2014 - schubi@suse.de

- AutoYaST Routing Import: Initialize device list correctly.
(bnc#900352)
- 3.1.108

-------------------------------------------------------------------
Fri Oct 10 15:20:36 CEST 2014 - locilka@suse.com

- Do not set default_route to "no" in auto-configuration in
inst-sys, just remove the entry completely (bnc#900466)
- 3.1.107

-------------------------------------------------------------------
Thu Oct 9 15:47:14 UTC 2014 - ancor@suse.com

- Improved help text in "global options" (bnc#892678)
- 3.1.106

-------------------------------------------------------------------
Mon Oct 6 09:31:41 UTC 2014 - mfilka@suse.com

- bnc#889287
- during autoconfiguration at s390 use linuxrc's OSAHWAddr param
for LLADDR when available.
- 3.1.105

-------------------------------------------------------------------
Tue Sep 30 10:15:38 UTC 2014 - ancor@suse.com

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


Name: yast2-network
Version: 3.1.104
Version: 3.1.109
Release: 0

BuildRoot: %{_tmppath}/%{name}-%{version}-build
Expand Down
11 changes: 8 additions & 3 deletions src/include/network/lan/help.rb
Expand Up @@ -47,18 +47,23 @@ def initialize_network_lan_help(include_target)
),
"managed" =>
# Network setup method help
# NetworkManager and ifup are programs
# NetworkManager and wicked are programs
_(
"<p><b><big>Network Setup Method</big></b></p>\n" +
"<p>Use the <b>NetworkManager</b> as a desktop applet\n" +
"managing connections for all interfaces. It is well suited\n" +
"for switching among wired and wireless networks.</p>\n"
) +
# Network setup method help
# NetworkManager and wicked are programs
_(
"<p>Use <b>wicked</b> if you do not run a desktop environment\n" +
"or need to use multiple interfaces at the same time.</p>\n"
) +
# For systems not including NetworkManager by default (bnc#892678)
_(
"<p><b>NetworkManager</b> is not part of every base\n" +
"installation repository. For example, to enable it on SUSE\n" +
"Linux Enterprise Server add the Workstation Extension\n" +
"repository and install the 'NetworkManager' package.</p>\n"
),
"overview" => _(
"<p><b><big>Network Card Overview</big></b><br>\n" +
Expand Down
2 changes: 1 addition & 1 deletion src/lib/network/install_inf_convertor.rb
Expand Up @@ -346,7 +346,7 @@ def create_wlan_ifcfg
end

def create_s390_ifcfg(hardware)
hwaddr = InstallInf["HWAddr"]
hwaddr = InstallInf["OSAHWAddr"]
return "" if hwaddr.empty?

netdevice = dev_name
Expand Down
7 changes: 5 additions & 2 deletions src/lib/network/network_autoconfiguration.rb
Expand Up @@ -206,7 +206,7 @@ def set_default_route_flag_if_wan_dev?(devname)
set_default_route_flag(devname, "yes")

if !activate_changes([devname])
log.warn("Cannot reach reference server via #{devname}")
log.warn("Cannot activate default_route for device #{devname}")
return false
end

Expand All @@ -218,7 +218,10 @@ def set_default_route_flag_if_wan_dev?(devname)
log.info("Release notes can be reached via #{devname}: #{reached}")

if !reached
set_default_route_flag(devname, "no")
# bsc#900466: Device is currently used for default route, but the test
# did not work, removing the default_route flag completely.
log.info "Removing default_route flag for device #{devname}"
set_default_route_flag(devname, nil)
activate_changes([devname])
end

Expand Down
28 changes: 20 additions & 8 deletions src/modules/Lan.rb
Expand Up @@ -614,14 +614,8 @@ def Write
)
end

if LanItems.force_restart
NetworkService.Restart
else
# 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 !Linuxrc.usessh
end
activate_network_service

Builtins.sleep(sl)
end

Expand Down Expand Up @@ -1153,6 +1147,24 @@ def HaveXenBridge
publish :function => :Packages, :type => "list <string> ()"
publish :function => :AutoPackages, :type => "map ()"
publish :function => :HaveXenBridge, :type => "boolean ()"

private
def activate_network_service
if LanItems.force_restart
log.info("Network service activation forced")
NetworkService.Restart
else
log.info(
("Attempting to reload network service, normal stage %s, ssh: %s") %
[Stage.normal, 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
end
end

end

Lan = LanClass.new
Expand Down
5 changes: 5 additions & 0 deletions src/modules/Routing.rb
Expand Up @@ -337,6 +337,11 @@ def write_routes(routes)
# @return true if success
def Import(settings)
settings = deep_copy(settings)

# Getting a list of devices which have already been imported by Lan.Import
# (bnc#900352)
@devices = NetworkInterfaces.List("")

ip_forward = Ops.get_boolean(settings, "ip_forward", false)
ipv4_forward = Ops.get_boolean(settings, "ipv4_forward", ip_forward)
ipv6_forward = Ops.get_boolean(settings, "ipv6_forward", ip_forward)
Expand Down
52 changes: 52 additions & 0 deletions test/ifroute_test.rb
Expand Up @@ -128,3 +128,55 @@
expect(Routing.write_routes(ROUTES_WITH_DEV)).to be true
end
end

describe "Routing#Write" do
AY_ROUTES = [
# empty AY config
{},
# some routes
{
"routes" => [
{
"destination" => "192.168.1.0",
"device" => "eth0",
"gateway" => "10.1.188.1",
"netmask" => "255.255.255.0"
},
{
"destination" => "10.1.230.0",
"device" => "eth0",
"gateway" => "10.1.18.254",
"netmask" => "255.255.255.0"
},
{
"destination" => "default",
"device" => "eth0",
"gateway" => "172.24.88.1",
"netmask" => "-"
},
]
}
]

AY_ROUTES.each_with_index do |ay_test, i|
it "does write route configuration files, ##{i}" do
# Devices which have already been imported by Lan.Import have to be read.
# (bnc#900352)
allow(NetworkInterfaces).
to receive(:List).
with("").
and_return(["eth0"])

Routing.Import(ay_test)

expect(Routing).
to receive(:write_route_file).
twice.
with(kind_of(String), ay_test.fetch("routes", [])).
and_return true

Routing.Write
end
end

end
2 changes: 1 addition & 1 deletion test/install_inf_convertor_test.rb
Expand Up @@ -283,7 +283,7 @@

expect(Yast::InstallInfConvertor::InstallInf)
.to receive(:[])
.with("HWAddr")
.with("OSAHWAddr")
.and_return(HWADDR)
expect(Yast::InstallInfConvertor.instance.send(:create_s390_ifcfg, nil).strip!)
.to eql ("LLADDR='#{HWADDR}'")
Expand Down
53 changes: 53 additions & 0 deletions test/lan_test.rb
Expand Up @@ -84,3 +84,56 @@
end

end

describe "LanClass#activate_network_service" do

Yast.import "Stage"
Yast.import "NetworkService"

[0, 1].each do |linuxrc_usessh|
ssh_flag = linuxrc_usessh != 0

context "when linuxrc %s usessh flag" % ssh_flag ? "sets" : "doesn't set" do
before(:each) do
allow(Yast::Linuxrc)
.to receive(:usessh)
.and_return(ssh_flag)
end

context "when asked in normal mode" do
before(:each) do
allow(Yast::Stage)
.to receive(:normal)
.and_return(true)
end

it "tries to reload network service" do
expect(Yast::NetworkService)
.to receive(:ReloadOrRestart)

Yast::Lan.send(:activate_network_service)
end
end

context "when asked during installation" do
before(:each) do
allow(Yast::Stage)
.to receive(:normal)
.and_return(false)
end

it "updates network service according usessh flag" do
if ssh_flag
expect(Yast::NetworkService)
.not_to receive(:ReloadOrRestart)
else
expect(Yast::NetworkService)
.to receive(:ReloadOrRestart)
end

Yast::Lan.send(:activate_network_service)
end
end
end
end
end
4 changes: 2 additions & 2 deletions test/network_autoconfiguration_test.rb
Expand Up @@ -171,7 +171,7 @@ def set(section, key, value)
it "configures just one NIC to have a default route" do
expect { instance.configure_dhcp }.to_not raise_error
result = Yast::NetworkInterfaces.FilterDevices("")
expect(result["eth"]["eth0"]["DHCLIENT_SET_DEFAULT_ROUTE"]).to eq "yes"
expect(result["eth"]["eth1"]["DHCLIENT_SET_DEFAULT_ROUTE"]).to_not eq "yes"
expect(result["eth"]["eth0"]["DHCLIENT_SET_DEFAULT_ROUTE"]).to eq "yes"
expect(result["eth"]["eth1"]["DHCLIENT_SET_DEFAULT_ROUTE"]).to eq nil
end
end
4 changes: 2 additions & 2 deletions test/routing_test.rb
Expand Up @@ -242,9 +242,9 @@ def fw_independent_write_expects

exported = Routing.Export
expect(exported["ipv4_forward"])
.to be_equal(ay_test["ipv4_forward"]) if ay_test.has_key?("ipv4_forward")
.to eql(ay_test[:input]["ipv4_forward"]) if ay_test[:input].has_key?("ipv4_forward")
expect(exported["ipv6_forward"])
.to be_equal(ay_test["ipv6_forward"]) if ay_test.has_key?("ipv6_forward")
.to eql(ay_test[:input]["ipv6_forward"]) if ay_test[:input].has_key?("ipv6_forward")
end
end
end
Expand Down

0 comments on commit 0c194af

Please sign in to comment.