Skip to content

Commit

Permalink
Merge branch 'SLE-12-SP1'
Browse files Browse the repository at this point in the history
Conflicts:
	src/modules/LanItems.rb
	testsuite/tests/Host-twospaces.rb
  • Loading branch information
mchf committed Dec 15, 2015
2 parents 12f979b + 7e7f27d commit e3b3333
Show file tree
Hide file tree
Showing 18 changed files with 257 additions and 73 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ 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 "rake yast2-devtools yast2-testsuite yast2 yast2-storage yast2-proxy yast2-country yast2-packager" -g "rspec:3.3.0 yast-rake gettext rubocop:0.29.1 simplecov coveralls"
- sh ./travis_setup.sh -p "rake yast2-devtools yast2-testsuite yast2 yast2-storage yast2-proxy yast2-country yast2-packager" -g "rspec:3.3.0 yast-rake gettext rubocop:0.29.1 simplecov:0.10.0 coveralls"
script:
- rubocop
- rake check:syntax
Expand Down
2 changes: 2 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
require "yast/rake"

Yast::Tasks.submit_to :sle12sp2

Yast::Tasks.configuration do |conf|
# lets ignore license check for now
conf.skip_license_check << /.*/
Expand Down
59 changes: 59 additions & 0 deletions package/yast2-network.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,62 @@
-------------------------------------------------------------------
Wed Dec 2 13:26:12 UTC 2015 - mfilka@suse.com

- bnc#957377
- When exporting AutoYaST profile, it contains dns configuration
even when this config was provided via linuxrc.
- 3.1.140

-------------------------------------------------------------------
Mon Nov 30 09:05:24 UTC 2015 - mfilka@suse.com

- bnc#951330
- drop record from /etc/hosts when deleting nic configuration
- bsc#954412 (igonzalezsosa@suse.com)
- Fix validation of AutoYaST profiles
- 3.1.139

-------------------------------------------------------------------
Wed Nov 25 21:01:49 UTC 2015 - mfilka@suse.com

- bnc#956605
- Write udev rules for renamed devices for non ssh / vnc AutoYaST
installations
- 3.1.138

-------------------------------------------------------------------
Mon Nov 23 09:54:34 UTC 2015 - mfilka@suse.com

- bnc#956012
- When exporting AutoYaST profile, it contains route definitions
even when these routes were configured using linuxrc.
- 3.1.137

-------------------------------------------------------------------
Mon Nov 16 21:33:18 UTC 2015 - mfilka@suse.com

- bnc#955217
- do not raise internal error during AY installation with profile
containing device renaming rule for unconfigured interface
- 3.1.136

-------------------------------------------------------------------
Mon Nov 16 05:52:07 UTC 2015 - mfilka@suse.com

- bnc#944349
- do not set links down when running AY installation over vnc.
VNC installation do not freeze.
- renaming network devices during ssh/vnc installation is
supported
-3.1.135

-------------------------------------------------------------------
Sun Nov 8 20:55:53 UTC 2015 - mfilka@suse.com

- bnc#944349
- do not set links down when running AY installation over ssh.
SSH installation do not freeze.
- 3.1.134

-------------------------------------------------------------------
Thu Oct 8 12:02:44 UTC 2015 - mvidner@suse.com

Expand Down
2 changes: 1 addition & 1 deletion package/yast2-network.spec
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@


Name: yast2-network
Version: 3.1.133
Version: 3.1.140
Release: 0

BuildRoot: %{_tmppath}/%{name}-%{version}-build
Expand Down
28 changes: 27 additions & 1 deletion src/autoyast-rnc/networking.rnc
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ interface =
element bonding_slave7 { text }? &
element bonding_slave8 { text }? &
element bonding_slave9 { text }? &
element bonding_module_opts { text }? &
element aliases { Anything }? &
broadcast? &
network? &
Expand All @@ -75,7 +76,13 @@ interface =
wireless? &
wifi_settings? &

dhclient_set_down_link?
bridge_settings? &
vlan_settings? &

dhclient_set_down_link? &
dhclient_set_default_route? &

element firewall { "yes" | "no" }?
}


Expand Down Expand Up @@ -112,6 +119,7 @@ remote_ipaddr = element remote_ipaddr { text }
bootproto = element bootproto { text }
broadcast = element broadcast { text }
dhclient_set_down_link = element dhclient_set_down_link { text }
dhclient_set_default_route = element dhclient_set_default_route { "yes" | "no" }
ipaddr = element ipaddr { text }
prefixlen = element prefixlen { text }
usercontrol = element usercontrol { text }
Expand Down Expand Up @@ -183,6 +191,24 @@ wireless_wpa_identity = element wireless_wpa_identity { text }
wireless_wpa_password = element wireless_wpa_password { text }
wireless_wpa_psk = element wireless_wpa_psk { text }

#
# Bridge
#
bridge_settings = (
element bridge { "yes" | "no" }? &
element bridge_ports { text }? &
element bridge_stp { "on" | "off" }? &
element bridge_forwarddelay { text }?
)

#
# VLAN
#
vlan_settings = (
element etherdevice { text }? &
element vlan_id { text }?
)

#
# MODULES
#
Expand Down
11 changes: 1 addition & 10 deletions src/clients/host.rb
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,6 @@ def main
# EOF
end

# Return a modification status
# @return true if data was modified
def Modified
Host.modified
end

# Main hosts GUI
def HostGUI
Host.Read
Expand All @@ -104,10 +98,7 @@ def HostGUI
ret = HostsMainDialog(true)
Builtins.y2debug("ret == %1", ret)

if ret == :next && Host.modified
Host.Write
# Not needed? RestartNetwork();
end
Host.Write if ret == :next && Host.GetModified

UI.CloseDialog
deep_copy(ret)
Expand Down
8 changes: 0 additions & 8 deletions src/clients/host_auto.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ def main
@ret = Host.Summary
# Reset configuration
elsif @func == "Reset"
Host.modified = false
Host.Import({})
@ret = {}
# Change configuration (run AutoSequence)
Expand Down Expand Up @@ -119,7 +118,6 @@ def main
elsif @func == "Write"
Yast.import "Progress"
@progress_orig = Progress.set(false)
Host.write_only = true
@ret = Host.Write
Progress.set(@progress_orig)
elsif @func == "SetModified"
Expand All @@ -139,12 +137,6 @@ def main

# EOF
end

# Return a modification status
# @return true if data was modified
def Modified
Host.modified
end
end
end

Expand Down
4 changes: 2 additions & 2 deletions src/clients/lan_auto.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,13 @@ def main
elsif @func == "Change"
@ret = LanAutoSequence("")
elsif @func == "Import"
@new = FromAY(@param)
# see bnc#498993
# in case keep_install_network is set to true (in AY)
# we'll keep values from installation
# and merge with XML data (bnc#712864)
@param = NetworkAutoYast.instance.merge_configs(@param) if @param["keep_install_network"]
@new = NetworkAutoYast.instance.merge_configs(@new) if @new["keep_install_network"]

@new = FromAY(@param)
Lan.Import(@new)
LanUdevAuto.Import(@new)
@ret = true
Expand Down
66 changes: 62 additions & 4 deletions src/clients/save_network.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,10 @@ def main
Yast.import "String"
Yast.import "Mode"
Yast.import "Arch"
Yast.import "LanUdevAuto"
Yast.import "Storage"
Yast.import "LanItems"
Yast.import "Profile"
Yast.import "Linuxrc"

Yast.include self, "network/routines.rb"
Yast.include self, "network/complex.rb"
Expand Down Expand Up @@ -189,14 +191,14 @@ def copy_udev_rules
log.info("File #{udev_rules_destdir} exists")
end

if !FileUtils.Exists(net_destfile)
if !Mode.update
log.info("Copying #{net_srcfile} to the installed system ")
WFM.Execute(
path(".local.bash"),
"/bin/cp -p '#{udev_rules_srcdir}/#{net_srcfile}' '#{net_destfile}'"
)
else
log.info("Not copying file #{net_destfile} - it already exists")
log.info("Not copying file #{net_destfile} - update mode")
end

nil
Expand All @@ -212,7 +214,8 @@ def copy_from_instsys
new_SCR = WFM.SCROpen("chroot=/:scr", false)
WFM.SCRSetDefault(new_SCR)

# --------------------------------------------------------------
ay_mode_configuration if Mode.autoinst

# Copy DHCP client cache so that we can request the same IP (#43974).
WFM.Execute(
path(".local.bash"),
Expand Down Expand Up @@ -263,6 +266,61 @@ def configure_target
nil
end

# Applies part of AY configuration at the end of first stage
#
# Intended mainly for steps which cannot be done in AY's second stage
#
# FIXME: Currently used only for applying udev rules during network
# installations (ssh, vnc, ...). It was introduced as a quick fix for
# bnc#944349, so it is currently limited only on {ssh|vnc} installations.
# Once properly analyzed and tested then starting of whole network second
# stage can be moved here.
def ay_mode_configuration
return if !Mode.autoinst
return if !(Linuxrc.usessh || Linuxrc.vnc)

ay_profile = Profile.current

log.info("Applying udev rules according AY profile")

return if ay_profile.nil? || ay_profile.empty?
return if ay_profile["networking"].nil? || ay_profile["networking"].empty?

udev_rules = ay_profile["networking"]["net-udev"]
log.info("- udev rules: #{udev_rules}")

return if udev_rules.nil? || udev_rules.empty?

LanItems.Read

udev_rules.each do |rule|
name_to = rule["name"]
attr = rule["rule"]
key = rule["value"].downcase
item, matching_item = LanItems.Items.find { |_, i| i["hwinfo"]["busid"].downcase == key || i["hwinfo"]["mac"].downcase == key }
next if !matching_item

# for logging only
name_from = matching_item["ifcfg"] || matching_item["dev_name"]
log.info("- renaming <#{name_from}> -> <#{name_to}>")

# selecting according device name is unreliable (selects only in between configured devices)
LanItems.current = item

# find out what attribude is currently used for setting device name and
# change it if needed. Currently mac is used by default. So, we check is it is
# the other one (busid). If no we defaults to mac.
bus_attr = LanItems.GetItemUdev("KERNELS")
current_attr = bus_attr.empty? ? "ATTR{address}" : "KERNELS"

# make sure that we base renaming on defined attribute with value given in AY profile
LanItems.ReplaceItemUdev(current_attr, attr, key)
LanItems.rename(name_to)
end

LanItems.write
end

# this replaces bash script create_interface
def save_network
log.info("starting save_network")
Expand Down
8 changes: 3 additions & 5 deletions src/include/network/lan/address.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1340,7 +1340,7 @@ def AddressDialog

@fwzone_initial = fwzone

host_list = Ops.get(Host.hosts, LanItems.ipaddr, [])
host_list = Host.names(LanItems.ipaddr)
if Ops.greater_than(Builtins.size(host_list), 1)
Builtins.y2milestone(
"More than one hostname for single IP detected, using the first one only"
Expand Down Expand Up @@ -1537,9 +1537,8 @@ def AddressDialog
ip_changed = LanItems.ipaddr !=
Ops.get_string(@settings, "IPADDR", "")
if ip_changed
Ops.set(Host.hosts, LanItems.ipaddr, [])
Host.set_names(LanItems.ipaddr, [])
Builtins.y2milestone("IP has changed")
Host.SetModified
end

LanItems.ipaddr = Ops.get_string(@settings, "IPADDR", "")
Expand All @@ -1549,15 +1548,14 @@ def AddressDialog

if @hostname_initial != Ops.get_string(@settings, "HOSTNAME", "") || ip_changed
if Ops.get_string(@settings, "HOSTNAME", "") == ""
Ops.set(Host.hosts, LanItems.ipaddr, [])
Host.set_names(LanItems.ipaddr, [])
else
Host.Update(
@hostname_initial,
Ops.get_string(@settings, "HOSTNAME", ""),
[Ops.get_string(@settings, "IPADDR", "")]
)
end
Host.SetModified
end
else
LanItems.ipaddr = ""
Expand Down
12 changes: 5 additions & 7 deletions src/include/network/lan/complex.rb
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ def handleOverview(_key, event)
"\n" \
"If you edit the settings for this interface here,\n" \
"the interface will no longer be managed by NetworkManager.\n"
)
)
)
# y2r: cannot break from middle of switch
# but in this function return will do
Expand Down Expand Up @@ -437,20 +437,18 @@ def handleOverview(_key, event)
LanItems.getCurrentItem,
["hwinfo", "dev_name"],
""
)
)
)
return :init_s390
end
end

return :edit
when :delete

when :delete
# warn user when device to delete has STARTMODE=nfsroot (bnc#433867)
if NetworkInterfaces.GetValue(
Ops.get_string(LanItems.getCurrentItem, "ifcfg", ""),
"STARTMODE"
) == "nfsroot"
devmap = LanItems.GetCurrentMap
if devmap && devmap["STARTMODE"] == "nfsroot"
if !Popup.YesNoHeadline(
Label.WarningMsg,
_("Device you select has STARTMODE=nfsroot. Really delete?")
Expand Down

0 comments on commit e3b3333

Please sign in to comment.