Hello community, here is the log from the commit of package yast2-network for openSUSE:Factory checked in at 2013-09-27 19:41:10 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/yast2-network (Old) and /work/SRC/openSUSE:Factory/.yast2-network.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "yast2-network" Changes: -------- --- /work/SRC/openSUSE:Factory/yast2-network/yast2-network.changes 2013-08-22 10:54:05.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.yast2-network.new/yast2-network.changes 2013-09-27 19:41:11.000000000 +0200 @@ -1,0 +2,48 @@ +Wed Sep 18 09:12:23 UTC 2013 - [email protected] + +- Refactoring + - removing ycp artifacts + - separated dialog for editing nic name into own class +- 3.0.7 + +------------------------------------------------------------------- +Wed Sep 11 09:34:47 UTC 2013 - [email protected] + +- bnc#578787 + - LanItems provides API for querying all available netcard devices +- 3.0.6 + +------------------------------------------------------------------- +Wed Sep 4 08:59:44 UTC 2013 - [email protected] + +- bnc#837793 + - Network Card details / General: show the assigned firewall zone; + previously "Automatically Assigned Zone" would be always shown. +- 3.0.5 + +------------------------------------------------------------------- +Tue Aug 27 08:20:41 UTC 2013 - [email protected] + +- do not overwrite curl log for addon (BNC#632917) +- 3.0.4 + +------------------------------------------------------------------- +Mon Aug 26 16:00:38 UTC 2013 - [email protected] + +- fix suggest for KDE network manager applet (BNC#747808) +- 3.0.3 + +------------------------------------------------------------------- +Thu Aug 22 12:26:42 UTC 2013 - [email protected] + +- Ported changes from SLE branch (bnc#831833) +- bnc#769081 + - do not remove line from /etc/hosts if it contains two spaces + between hostnames +- bnc#810539 + - fixed issue in YaPI which caused a syntax warning +- fate#308978 + - do not write network config files if not changed +- 3.0.2 + +------------------------------------------------------------------- Old: ---- yast2-network-3.0.1.tar.bz2 New: ---- yast2-network-3.0.7.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ yast2-network.spec ++++++ --- /var/tmp/diff_new_pack.d90hxT/_old 2013-09-27 19:41:12.000000000 +0200 +++ /var/tmp/diff_new_pack.d90hxT/_new 2013-09-27 19:41:12.000000000 +0200 @@ -17,7 +17,7 @@ Name: yast2-network -Version: 3.0.1 +Version: 3.0.7 Release: 0 BuildRoot: %{_tmppath}/%{name}-%{version}-build @@ -128,6 +128,8 @@ /usr/lib/YaST2/servers_non_y2/ag_udev_persistent /usr/share/YaST2/schema/autoyast/rnc/networking.rnc /usr/share/YaST2/schema/autoyast/rnc/host.rnc +/usr/share/YaST2/lib/ +/usr/share/YaST2/lib/network %dir %{_prefix}/share/doc/packages/yast2-network %{_prefix}/share/doc/packages/yast2-network/COPYING ++++++ yast2-network-3.0.1.tar.bz2 -> yast2-network-3.0.7.tar.bz2 ++++++ ++++ 1917 lines of diff (skipped) ++++ retrying with extended exclude list diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/yast2-network-3.0.1/Makefile.am new/yast2-network-3.0.7/Makefile.am --- old/yast2-network-3.0.1/Makefile.am 2013-08-21 12:46:57.000000000 +0200 +++ new/yast2-network-3.0.7/Makefile.am 2013-09-23 09:57:05.000000000 +0200 @@ -193,4 +193,4 @@ test ! -f $(srcdir)/po/Makefile || $(MAKE) -C po checkpo # test ! -f $(srcdir)/po/Makefile || $(MAKE) -C po checkpo make-pox # No ./SUBDIRS file found - assuming default: All direct subdirs with Makefile.am -SUBDIRS = agents data doc src testsuite +SUBDIRS = agents data doc src test testsuite diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/yast2-network-3.0.1/VERSION new/yast2-network-3.0.7/VERSION --- old/yast2-network-3.0.1/VERSION 2013-08-21 12:46:50.000000000 +0200 +++ new/yast2-network-3.0.7/VERSION 2013-09-19 18:01:52.000000000 +0200 @@ -1 +1 @@ -3.0.1 +3.0.7 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/yast2-network-3.0.1/configure.ac new/yast2-network-3.0.7/configure.ac --- old/yast2-network-3.0.1/configure.ac 2013-08-21 12:46:57.000000000 +0200 +++ new/yast2-network-3.0.7/configure.ac 2013-09-23 09:57:05.000000000 +0200 @@ -1,9 +1,9 @@ dnl configure.ac for yast2-network dnl -dnl -- This file is generated by y2autoconf 3.0.4 - DO NOT EDIT! -- +dnl -- This file is generated by y2autoconf 3.0.5 - DO NOT EDIT! -- dnl (edit configure.ac.in or configure.in.in instead) -AC_INIT(yast2-network, 3.0.1, http://bugs.opensuse.org/, yast2-network) +AC_INIT(yast2-network, 3.0.7, http://bugs.opensuse.org/, yast2-network) dnl Check for presence of file 'RPMNAME' AC_CONFIG_SRCDIR([RPMNAME]) @@ -18,7 +18,7 @@ AM_INIT_AUTOMAKE(tar-ustar -Wno-portability) dnl Important YaST2 variables -VERSION="3.0.1" +VERSION="3.0.7" RPMNAME="yast2-network" MAINTAINER="Michal Filka <[email protected]>" @@ -168,6 +168,7 @@ doc/autodocs/Makefile doc/Makefile src/Makefile +test/Makefile testsuite/Makefile) AC_OUTPUT diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/yast2-network-3.0.1/src/Makefile.am new/yast2-network-3.0.7/src/Makefile.am --- old/yast2-network-3.0.1/src/Makefile.am 2013-07-30 13:21:05.000000000 +0200 +++ new/yast2-network-3.0.7/src/Makefile.am 2013-09-19 18:01:52.000000000 +0200 @@ -164,6 +164,29 @@ desktop/dsl.desktop \ desktop/lan.desktop -EXTRA_DIST = $(module_DATA) $(module1_DATA) $(client_DATA) $(ynclude_DATA) $(ynclude1_DATA) $(ynclude2_DATA) $(ynclude3_DATA) $(ynclude4_DATA) $(ynclude5_DATA) $(ynclude6_DATA) $(ynclude7_DATA) $(ynclude8_DATA) $(scrconf_DATA) $(agent_SCRIPTS) $(schemafiles_DATA) $(ybin_SCRIPTS) $(ydata_DATA) $(desktop_DATA) +ylibdir = "${yast2dir}/lib/network" +ylib_DATA = \ + lib/network/edit_nic_name.rb -include $(top_srcdir)/Makefile.am.common \ No newline at end of file +EXTRA_DIST = \ + $(module_DATA) \ + $(module1_DATA) \ + $(client_DATA) \ + $(ynclude_DATA) \ + $(ynclude1_DATA) \ + $(ynclude2_DATA) \ + $(ynclude3_DATA) \ + $(ynclude4_DATA) \ + $(ynclude5_DATA) \ + $(ynclude6_DATA) \ + $(ynclude7_DATA) \ + $(ynclude8_DATA) \ + $(scrconf_DATA) \ + $(agent_SCRIPTS) \ + $(schemafiles_DATA) \ + $(ybin_SCRIPTS) \ + $(ydata_DATA) \ + $(desktop_DATA) \ + $(ylib_DATA) + +include $(top_srcdir)/Makefile.am.common diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/yast2-network-3.0.1/src/clients/inst_do_net_test.rb new/yast2-network-3.0.7/src/clients/inst_do_net_test.rb --- old/yast2-network-3.0.1/src/clients/inst_do_net_test.rb 2013-07-30 13:21:05.000000000 +0200 +++ new/yast2-network-3.0.7/src/clients/inst_do_net_test.rb 2013-08-27 10:31:50.000000000 +0200 @@ -531,7 +531,6 @@ ##390738: only one URL now #works well with the list of all products - # string url = Product::relnotesurl; Builtins.foreach(Product.relnotesurl_all) do |url| # protect from wrong urls if url == nil || url == "" @@ -543,7 +542,6 @@ Builtins.y2error("broken url for release notes: %1", url) next false end - #relnotes_counter = relnotes_counter + 1; # Where we want to store the downloaded release notes filename = Builtins.sformat( "%1/%2-%3", @@ -636,6 +634,8 @@ @logs, { :menuname => menu_name, :filename => log_filename } ) + + relnotes_counter += 1; end test_ret end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/yast2-network-3.0.1/src/clients/lan.rb new/yast2-network-3.0.7/src/clients/lan.rb --- old/yast2-network-3.0.1/src/clients/lan.rb 2013-07-30 13:21:05.000000000 +0200 +++ new/yast2-network-3.0.7/src/clients/lan.rb 2013-09-19 18:01:52.000000000 +0200 @@ -194,12 +194,18 @@ } } - @ret = CommandLine.Run(@cmdline) - Builtins.y2debug("ret=%1", @ret) + begin + @ret = CommandLine.Run(@cmdline) + Builtins.y2debug("ret=%1", @ret) + rescue Exception => e + Report.Error(_("Internal error. Please report a bug.")) + Builtins.y2internal("LanClient exception:") + Builtins.y2internal(e.backtrace.inspect) + end # Finish Builtins.y2milestone("Lan module finished") - Builtins.y2milestone("----------------------------------------") + Builtins.y2milestone("----------------------------------------") # EOF diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/yast2-network-3.0.1/src/include/network/lan/address.rb new/yast2-network-3.0.7/src/include/network/lan/address.rb --- old/yast2-network-3.0.1/src/include/network/lan/address.rb 2013-07-30 13:21:05.000000000 +0200 +++ new/yast2-network-3.0.7/src/include/network/lan/address.rb 2013-09-06 14:11:50.000000000 +0200 @@ -1241,7 +1241,7 @@ # Dialog for setting up IP address # @return dialog result def AddressDialog - fwzone = SuSEFirewall4Network.GetZoneOfInterface(LanItems.device) + fwzone = SuSEFirewall4Network.GetZoneOfInterface(LanItems.GetCurrentName) # If firewall is active and interface in no zone, nothing # gets through (#62309) so add it to the external zone @@ -1263,7 +1263,6 @@ @settings = { # general tab: - # "IFNAME": ifname, "STARTMODE" => LanItems.startmode( ), "IFPLUGD_PRIORITY" => LanItems.ifplugd_priority, @@ -1408,7 +1407,6 @@ ] ] ) - #wd["BINDTOHW", "items"] = ...; if fw_is_installed Ops.set( @@ -1463,8 +1461,7 @@ HStretch(), HSquash( VBox( - # `VSpacing(0.4), - "ADVANCED_MB" # `VSpacing(0.4) + "ADVANCED_MB" ) ), HStretch() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/yast2-network-3.0.1/src/include/network/lan/cmdline.rb new/yast2-network-3.0.7/src/include/network/lan/cmdline.rb --- old/yast2-network-3.0.1/src/include/network/lan/cmdline.rb 2013-07-30 13:21:05.000000000 +0200 +++ new/yast2-network-3.0.7/src/include/network/lan/cmdline.rb 2013-09-23 09:56:51.000000000 +0200 @@ -249,7 +249,7 @@ if Builtins.size(Ops.get_string(LanItems.getCurrentItem, "ifcfg", "")) == 0 NetworkInterfaces.Add LanItems.operation = :edit - LanItems.interfacename = Ops.get_string( + interfacename = Ops.get_string( LanItems.getCurrentItem, ["hwinfo", "dev_name"], "" @@ -257,7 +257,7 @@ Ops.set( LanItems.Items, [LanItems.current, "ifcfg"], - LanItems.interfacename + interfacename ) end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/yast2-network-3.0.1/src/include/network/lan/complex.rb new/yast2-network-3.0.7/src/include/network/lan/complex.rb --- old/yast2-network-3.0.1/src/include/network/lan/complex.rb 2013-07-30 13:21:05.000000000 +0200 +++ new/yast2-network-3.0.7/src/include/network/lan/complex.rb 2013-08-27 08:26:50.000000000 +0200 @@ -356,7 +356,7 @@ _("Applet needed"), _( "NetworkManager is controlled by desktop applet\n" + - "(knetworkmanager for KDE and nm-applet for GNOME).\n" + + "(KDE plasma widget and nm-applet for GNOME).\n" + "Be sure it's running and if not, start it manually." ) ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/yast2-network-3.0.1/src/include/network/lan/hardware.rb new/yast2-network-3.0.7/src/include/network/lan/hardware.rb --- old/yast2-network-3.0.1/src/include/network/lan/hardware.rb 2013-07-30 13:21:05.000000000 +0200 +++ new/yast2-network-3.0.7/src/include/network/lan/hardware.rb 2013-09-19 18:01:52.000000000 +0200 @@ -26,6 +26,9 @@ # Summary: Hardware dialogs # Authors: Michal Svec <[email protected]> # + +require "network/edit_nic_name" + module Yast module NetworkLanHardwareInclude def initialize_network_lan_hardware(include_target) @@ -584,144 +587,12 @@ deep_copy(ret) end - # Checks if given name can be accepted as nic's new one. - # - # @return false and pops up an explanation if the name is invalid - def CheckUdevNicName(name) - # when dev_name changed, rename ifcfg (both in NetworkInterfaces and LanItems) - error = false - - if UsedNicName(name) - Popup.Error(_("Configuration name already exists.")) - return false - end - if !ValidNicName(name) - Popup.Error(_("Invalid configuration name.")) - return false - end - - true - end - # Dialog for editing nic's udev rules. # # @return nic name. New one if `ok, old one otherwise. def EditUdevRulesDialog - UI.OpenDialog( - VBox( - RadioButtonGroup( - Id(:udev_type), - VBox( - #make sure there is enough space (#367239) - HSpacing(30), - Label(_("Rule by:")), - Left( - RadioButton( - Id(:mac), - Builtins.sformat( - "MAC address : %1", - Ops.get_string( - LanItems.getCurrentItem, - ["hwinfo", "mac"], - "" - ) - ) - ) - ), - Left( - RadioButton( - Id(:busid), - Builtins.sformat( - "BusID : %1", - Ops.get_string( - LanItems.getCurrentItem, - ["hwinfo", "busid"], - "" - ) - ) - ) - ) - ) - ), - Left( - HBox( - CheckBox( - Id(:change_dev_name), - Opt(:notify), - _("Change DeviceName"), - false - ), - InputField(Id(:dev_name), "", LanItems.GetItemUdev("NAME")) - ) - ), - VSpacing(0.5), - HBox( - PushButton(Id(:ok), Opt(:default), Label.OKButton), - PushButton(Id(:cancel), Label.CancelButton) - ) - ) - ) - - if Ops.greater_than( - Builtins.size(LanItems.GetItemUdev("ATTR{address}")), - 0 - ) - UI.ChangeWidget(Id(:udev_type), :CurrentButton, :mac) - else - if Ops.greater_than(Builtins.size(LanItems.GetItemUdev("KERNELS")), 0) - UI.ChangeWidget(Id(:udev_type), :CurrentButton, :busid) - else - Builtins.y2error("Unknown udev rule ") - end - end - - UI.ChangeWidget(:dev_name, :Enabled, false) - - ret = nil - while ret != :cancel && ret != :abort && ret != :ok - ret = UI.UserInput - change_name_active = Convert.to_boolean( - UI.QueryWidget(:change_dev_name, :Value) - ) - - if ret == :change_dev_name - UI.ChangeWidget(:dev_name, :Enabled, change_name_active) - end - - if ret == :ok - old_name = LanItems.GetItemUdev("NAME") - new_name = Convert.to_string(UI.QueryWidget(:dev_name, :Value)) - rule_key = UI.QueryWidget(:udev_type, :CurrentButton) == :mac ? "ATTR{address}" : "KERNELS" - rule_value = UI.QueryWidget(:udev_type, :CurrentButton) == :mac ? - Ops.get_string(LanItems.getCurrentItem, ["hwinfo", "mac"], "") : - Ops.get_string(LanItems.getCurrentItem, ["hwinfo", "busid"], "") - - if change_name_active && new_name != old_name - if CheckUdevNicName(new_name) - LanItems.SetItemUdev("NAME", new_name) - - NetworkInterfaces.Delete2(old_name) - Ops.set( - LanItems.Items, - [LanItems.current, "ifcfg"], - LanItems.GetItemUdev("NAME") - ) - else - UI.SetFocus(:dev_name) - ret = nil - - next - end - end - - # update udev rules - old_key = Builtins.isempty(LanItems.GetItemUdev("KERNELS")) ? "ATTR{address}" : "KERNELS" - LanItems.ReplaceItemUdev(old_key, rule_key, rule_value) - end - end - UI.CloseDialog - - Ops.get_string(LanItems.Items, [LanItems.current, "ifcfg"], "") + edit_name_dlg = EditNicName.new + edit_name_dlg.run end def handleHW(key, event) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/yast2-network-3.0.1/src/include/network/lan/s390.rb new/yast2-network-3.0.7/src/include/network/lan/s390.rb --- old/yast2-network-3.0.1/src/include/network/lan/s390.rb 2013-07-30 13:21:05.000000000 +0200 +++ new/yast2-network-3.0.7/src/include/network/lan/s390.rb 2013-09-11 11:41:59.000000000 +0200 @@ -59,6 +59,7 @@ # # @return a map with keys QETH_LAYER2, QETH_PORTNAME, QETH_PORTNUMBER, QETH_CHANIDS def s390_ReadQethConfig(devname) + return {} if devname.empty? return {} if !s390_DriverLoaded(devname) result = {} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/yast2-network-3.0.1/src/include/network/lan/virtual.rb new/yast2-network-3.0.7/src/include/network/lan/virtual.rb --- old/yast2-network-3.0.1/src/include/network/lan/virtual.rb 2013-07-30 13:21:05.000000000 +0200 +++ new/yast2-network-3.0.7/src/include/network/lan/virtual.rb 2013-09-23 09:56:51.000000000 +0200 @@ -40,6 +40,7 @@ Yast.import "Popup" Yast.import "Report" Yast.import "Wizard" + Yast.import "String" Yast.include include_target, "network/routines.rb" end @@ -193,6 +194,10 @@ nil end + + # max length of device / interface filename lenght supported by kernel + IFACE_LABEL_MAX = 16 + def VirtualEditDialog(id, entry, forbidden) entry = deep_copy(entry) forbidden = deep_copy(forbidden) @@ -227,10 +232,9 @@ UI.ChangeWidget( Id(:name), :ValidChars, - "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" + String.calnum ) UI.ChangeWidget(Id(:ipaddr), :ValidChars, IP.ValidChars) - # UI::ChangeWidget(`id(`netmask), `ValidChars, Netmask::ValidChars); if entry == term(:empty) UI.SetFocus(Id(:name)) @@ -238,36 +242,23 @@ UI.SetFocus(Id(:ipaddr)) end - ret = nil - host = nil - while true host = nil ret = UI.UserInput break if ret != :ok host = Item(Id(id)) - val = Convert.to_string(UI.QueryWidget(Id(:name), :Value)) - if Ops.greater_than( - Ops.add( - Ops.add(Builtins.size(LanItems.interfacename), Builtins.size(val)), - 1 - ), - 16 - ) + val = UI.QueryWidget(Id(:name), :Value) + if Builtins.size(LanItems.device) + Builtins.size(val) + 1 > IFACE_LABEL_MAX # Popup::Error text Popup.Error(_("Label is too long.")) UI.SetFocus(Id(:name)) next end - # if(contains(forbidden, val)) { - # Popup::Error(sformat(_("IP address %1 is already present."), val)); - # UI::SetFocus(`id(`host)); - # continue; - # } + host = Builtins.add(host, val) - ip = Convert.to_string(UI.QueryWidget(Id(:ipaddr), :Value)) + ip = UI.QueryWidget(Id(:ipaddr), :Value) if !IP.Check(ip) # Popup::Error text Popup.Error(_("The IP address is invalid.")) @@ -276,7 +267,7 @@ end host = Builtins.add(host, ip) - val = Convert.to_string(UI.QueryWidget(Id(:netmask), :Value)) + val = UI.QueryWidget(Id(:netmask), :Value) if !validPrefixOrNetmask(ip, val) # Popup::Error text Popup.Error(_("The subnet mask is invalid.")) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/yast2-network-3.0.1/src/lib/network/edit_nic_name.rb new/yast2-network-3.0.7/src/lib/network/edit_nic_name.rb --- old/yast2-network-3.0.1/src/lib/network/edit_nic_name.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-network-3.0.7/src/lib/network/edit_nic_name.rb 2013-09-19 18:01:52.000000000 +0200 @@ -0,0 +1,166 @@ +# encoding: utf-8 + +require 'yast' + +module Yast + + Yast.import "UI" + Yast.import "LanItems" + Yast.import "Popup" + + # The class represents a simple dialog which allows user to input new NIC + # name. It also allows to select a device attribute (MAC, Bus id, ...) which will + # be used for device selection. + class EditNicName + + include UIShortcuts + include I18n + + # udev rule attribute for MAC address + MAC_UDEV_ATTR = "ATTR{address}" + + # udev rule attribute for BUS id + BUSID_UDEV_ATTR = "KERNELS" + + def initialize + + textdomain "network" + + Yast.include self, "network/routines.rb" + + current_item = LanItems.getCurrentItem + + @old_name = LanItems.GetItemUdev("NAME") + + @old_key = MAC_UDEV_ATTR unless LanItems.GetItemUdev( MAC_UDEV_ATTR).empty? + @old_key = BUSID_UDEV_ATTR unless LanItems.GetItemUdev( BUSID_UDEV_ATTR).empty? + + if current_item["hwinfo"] + @mac = current_item["hwinfo"]["mac"] + @bus_id = current_item["hwinfo"]["busid"] + else + @mac = "" + @bus_id = "" + end + end + + # Opens dialog for editing NIC name and runs event loop. + # + # @return [String] new NIC name + def run + open + + ret = nil + while ![:cancel, :abort, :ok].include? ret + ret = UI.UserInput + + case ret + when :ok + new_name = UI.QueryWidget(:dev_name, :Value) + + if new_name != @old_name + if CheckUdevNicName(new_name) + LanItems.SetCurrentName( new_name) + else + UI.SetFocus(:dev_name) + ret = nil + + next + end + end + + if UI.QueryWidget(:udev_type, :CurrentButton) == :mac + rule_key = MAC_UDEV_ATTR + rule_value = @mac + else + rule_key = BUSID_UDEV_ATTR + rule_value = @bus_id + end + + # update udev rules and other config + LanItems.ReplaceItemUdev(@old_key, rule_key, rule_value) + end + end + + close + + LanItems.GetCurrentName + end + + private + # Opens dialog for editing NIC name + def open + UI.OpenDialog( + VBox( + Left( + HBox( + Label(_("Device name:")), + InputField(Id(:dev_name), "", @old_name) + ) + ), + VSpacing(0.5), + Frame( + _("Base udev rule on"), + RadioButtonGroup( + Id(:udev_type), + VBox( + #make sure there is enough space (#367239) + HSpacing(30), + Left( + RadioButton( + Id(:mac), + _("MAC address: %s") % @mac + ) + ), + Left( + RadioButton( + Id(:busid), + _("BusID: %s") % @bus_id + ) + ) + ) + ), + ), + VSpacing(0.5), + HBox( + PushButton(Id(:ok), Opt(:default), Label.OKButton), + PushButton(Id(:cancel), Label.CancelButton) + ) + ) + ) + + case @old_key + when MAC_UDEV_ATTR + UI.ChangeWidget(Id(:udev_type), :CurrentButton, :mac) + when BUSID_UDEV_ATTR + UI.ChangeWidget(Id(:udev_type), :CurrentButton, :busid) + else + Builtins.y2error("Unknown udev rule.") + end + end + + # Closes the dialog + def close + UI.CloseDialog + end + + # Checks if given name can be accepted as nic's new one. + # + # Pops up an explanation if the name is invalid + # + # @return [boolean] false if name is invalid + def CheckUdevNicName(name) + if UsedNicName(name) + Popup.Error(_("Configuration name already exists.")) + return false + end + if !ValidNicName(name) + Popup.Error(_("Invalid configuration name.")) + return false + end + + true + end + + end +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/yast2-network-3.0.1/src/modules/DNS.rb new/yast2-network-3.0.7/src/modules/DNS.rb --- old/yast2-network-3.0.1/src/modules/DNS.rb 2013-07-30 13:21:05.000000000 +0200 +++ new/yast2-network-3.0.7/src/modules/DNS.rb 2013-08-26 12:01:51.000000000 +0200 @@ -355,15 +355,26 @@ @oldhostname = fqhostname # #49634 - SCR.Write( - path(".sysconfig.network.dhcp.DHCLIENT_SET_HOSTNAME"), - @dhcp_hostname ? "yes" : "no" - ) - SCR.Write( - path(".sysconfig.network.dhcp.WRITE_HOSTNAME_TO_HOSTS"), - @write_hostname ? "yes" : "no" - ) - SCR.Write(path(".sysconfig.network.dhcp"), nil) + # ensure that nothing is saved in case old values are the same, as it makes + # rcnetwork reload restart all interfaces (even 'touch /etc/sysconfig/network/dhcp' + # is sufficient) + tmp = SCR.Read(path(".sysconfig.network.dhcp.DHCLIENT_SET_HOSTNAME")) + old_dhcp_hostname = tmp == "yes" + + tmp = SCR.Read(path(".sysconfig.network.dhcp.WRITE_HOSTNAME_TO_HOSTS")) + old_write_hostname = tmp == "yes" + + if old_dhcp_hostname != dhcp_hostname || old_write_hostname != write_hostname + SCR.Write( + path(".sysconfig.network.dhcp.DHCLIENT_SET_HOSTNAME"), + @dhcp_hostname ? "yes" : "no" + ) + SCR.Write( + path(".sysconfig.network.dhcp.WRITE_HOSTNAME_TO_HOSTS"), + @write_hostname ? "yes" : "no" + ) + SCR.Write(path(".sysconfig.network.dhcp"), nil) + end Builtins.y2milestone("Writing configuration") if !@modified diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/yast2-network-3.0.1/src/modules/Host.rb new/yast2-network-3.0.7/src/modules/Host.rb --- old/yast2-network-3.0.1/src/modules/Host.rb 2013-07-30 13:21:05.000000000 +0200 +++ new/yast2-network-3.0.7/src/modules/Host.rb 2013-08-26 12:01:51.000000000 +0200 @@ -251,16 +251,17 @@ @modified = true nick = Ops.get(Hostname.SplitFQ(newhn), 0, "") - oldnick = Ops.get(Hostname.SplitFQ(oldhn), 0, "") # Remove old hostname from hosts # list oldhnlist = []; - Builtins.foreach(@hosts) do |ip, hs| - wrk = Builtins.maplist(hs) { |s| Builtins.splitstring(s, " ") } - wrk = Builtins.filter(wrk) { |lst| !Builtins.contains(lst, oldhn) } - Ops.set(@hosts, ip, Builtins.maplist(wrk) do |lst| - Builtins.mergestring(lst, " ") - end) + if !oldhn.empty? + Builtins.foreach(@hosts) do |ip, hs| + wrk = Builtins.maplist(hs) { |s| Builtins.splitstring(s, " ") } + wrk = Builtins.filter(wrk) { |lst| !Builtins.contains(lst, oldhn) } + Ops.set(@hosts, ip, Builtins.maplist(wrk) do |lst| + Builtins.mergestring(lst, " ") + end) + end end # Resurect the rest of oldhnlist without old hostname diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/yast2-network-3.0.1/src/modules/Lan.rb new/yast2-network-3.0.7/src/modules/Lan.rb --- old/yast2-network-3.0.1/src/modules/Lan.rb 2013-07-30 13:21:05.000000000 +0200 +++ new/yast2-network-3.0.7/src/modules/Lan.rb 2013-09-23 09:56:51.000000000 +0200 @@ -992,7 +992,6 @@ return false if LanItems.Select(name) != true NetworkInterfaces.Edit(name) LanItems.operation = :edit - LanItems.interfacename = NetworkInterfaces.Name true end # Delete the given device diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/yast2-network-3.0.1/src/modules/LanItems.rb new/yast2-network-3.0.7/src/modules/LanItems.rb --- old/yast2-network-3.0.1/src/modules/LanItems.rb 2013-07-30 13:21:05.000000000 +0200 +++ new/yast2-network-3.0.7/src/modules/LanItems.rb 2013-09-23 09:56:51.000000000 +0200 @@ -45,12 +45,6 @@ @udev_net_rules = {} @driver_options = {} - # FIXME: what's the difference against "device" defined below? - # some refactoring led to interfacename = device in SetItem. - # Probably, interfacename is used outside. It is only set in - # this file. - @interfacename = "" - # used at autoinstallation time @autoinstall_settings = {} @@ -71,6 +65,7 @@ #global string unique = ""; @type = "" + # ifcfg name for the @current device @device = "" #FIXME: always empty string - remove all occuriences @alias = "" @@ -335,6 +330,15 @@ ) end + # transforms given list of item ids onto device names + # + # item id is index into internal @Items structure + def GetDeviceNames( items) + return [] unless items + + items.map { |itemId| GetDeviceName( itemId) }.reject( &:empty?) + end + # Returns device name for current lan item (see LanItems::current) def GetCurrentName GetDeviceName(@current) @@ -478,6 +482,31 @@ ReplaceItemUdev(rule_key, rule_key, rule_val) end + # Updates device name. + # + # It updates device's udev rules and config name. + # + # Returns new name + def SetItemName( itemId, name) + SetItemUdev("NAME", name) + + if @Items[ itemId].has_key?( "ifcfg") + NetworkInterfaces.Delete2( @Items[ itemId][ "ifcfg"]) + @Items[ itemId][ "ifcfg"] = name + end + + name + end + + # Updates current device name. + # + # It updates device's udev rules and config name. + # + # Returns new name + def SetCurrentName( name) + SetItemName( @current, name) + end + # Writes udev rules for all items. # # Currently only interesting change is renaming interface. @@ -790,6 +819,19 @@ ) end + # Creates list of all known netcard items + # + # It means list of item ids of all netcards which are detected and/or + # configured in the system + def GetNetcardInterfaces + @Items.keys + end + + # Creates list of names of all known netcards + def GetNetcardNames + GetDeviceNames( GetNetcardInterfaces()) + end + # get list of all configurations for "netcard" macro in NetworkInterfaces module def getNetworkInterfaces confs = [] @@ -853,6 +895,7 @@ ret end + # preinitializates @Items according info on physically detected network cards def ReadHw @Items = {} @Hardware = ReadHardware("netcard") @@ -904,6 +947,14 @@ nil end + # initializates @Items + # + # It does: + # (1) read hardware present on the system + # (2) read known configurations (e.g. ifcfg-eth0) + # (3) joins together. Join is done via device name (e.g. eth0) as key. + # It is full outer join in -> you can have hwinfo part with no coresponding + # netconfig part (or vice versa) in @Items when the method is done. def Read ReadHw() NetworkInterfaces.Read @@ -1463,37 +1514,9 @@ :to => "list <string>" ) - mac = Ops.get_string(hardware, "mac", "") busid = Ops.get_string(hardware, "busid", "") - - # nm_name = createHwcfgName(hardware, type); - - @interfacename = Ops.get_string(hardware, "dev_name", "") - - # name of ifcfg - # eth, tr, not on s390 (#38819) - if !Arch.s390 && mac != nil && mac != "" && mac != "00:00:00:00:00:00" - @device = Ops.add("id-", Ops.get_string(hardware, "mac", "")) - # iucv already filled in from lan/hardware.ycp (#42212) - elsif @type == "iucv" - Builtins.y2debug("IUCV: %1", @device) - # other devs - elsif busid != nil && busid != "" - @device = Ops.add( - Ops.add(Ops.add("bus-", Ops.get_string(hardware, "bus", "")), "-"), - Ops.get_string(hardware, "busid", "") - ) - # USB, PCMCIA - elsif Ops.get_string(hardware, "hotplug", "") != "" - @device = Ops.add("bus-", Ops.get_string(hardware, "hotplug", "")) - else - # dummy - Builtins.y2milestone("No detailed HW info: %1", @device) - end - Builtins.y2milestone("hw=%1", hardware) - Builtins.y2milestone("device=%1", @device) @hw = deep_copy(hardware) if Arch.s390 && @operation == :add Builtins.y2internal("Propose chan_ids values for %1", @hw) @@ -2321,7 +2344,6 @@ def SetItem @operation = :edit @device = Ops.get_string(getCurrentItem, "ifcfg", "") - @interfacename = @device NetworkInterfaces.Edit(@device) @type = Ops.get_string(getCurrentItem, ["hwinfo", "type"], "") @@ -2527,7 +2549,6 @@ publish :variable => :Hardware, :type => "list <map>" publish :variable => :udev_net_rules, :type => "map <string, any>" publish :variable => :driver_options, :type => "map <string, any>" - publish :variable => :interfacename, :type => "string" publish :variable => :autoinstall_settings, :type => "map" publish :variable => :modified, :type => "boolean" publish :variable => :operation, :type => "symbol" @@ -2613,6 +2634,7 @@ publish :function => :GetSlaveCandidates, :type => "list <integer> (string, boolean (string, integer))" publish :function => :GetBondableInterfaces, :type => "list <integer> (string)" publish :function => :GetBridgeableInterfaces, :type => "list <integer> (string)" + publish :function => :GetNetcardNames, :type => "list <string> ( list <integer>)" publish :function => :FindAndSelect, :type => "boolean (string)" publish :function => :FindDeviceIndex, :type => "integer (string)" publish :function => :ReadHw, :type => "void ()" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/yast2-network-3.0.1/src/modules/LanUdevAuto.rb new/yast2-network-3.0.7/src/modules/LanUdevAuto.rb --- old/yast2-network-3.0.1/src/modules/LanUdevAuto.rb 2013-07-30 13:21:05.000000000 +0200 +++ new/yast2-network-3.0.7/src/modules/LanUdevAuto.rb 2013-09-23 09:56:51.000000000 +0200 @@ -73,54 +73,37 @@ InstallationParameter("biosdevname") != "1" end + # It finds a new style device name for device name in old fashioned format + # + # It goes through currently present devices and tries to mach it to given + # old fashioned name + # + # @returns [String] new style name in case of success. Given name otherwise. def getDeviceName(oldname) + # TODO: + # raise an exception when old name could not be matched to existing cfg. newname = oldname + @hardware = ReadHardware("netcard") if @hardware == nil - if Builtins.issubstring(oldname, "-id-") - Builtins.y2milestone("device by ID found %1", oldname) + @hardware.each do |hw| + hw_dev_name = hw["dev_name"] || "" + hw_dev_mac = hw["mac"] || "" + hw_dev_busid = hw["busid"] || "" - mac_from_ay = Ops.get( - Builtins.splitstring(Builtins.tostring(oldname), "-"), - 2, - "" - ) - Builtins.y2milestone("MAC address from AY : %1", mac_from_ay) - Builtins.foreach(@hardware) do |hw| - Builtins.y2milestone("hw %1", Ops.get_string(hw, "mac", "")) - if Ops.get_string(hw, "mac", "") == mac_from_ay - Builtins.y2milestone( - "device matched : %1", - Ops.get_string(hw, "dev_name", "") - ) - newname = Ops.get_string(hw, "dev_name", "") - end - end - elsif Builtins.issubstring(oldname, "-bus-") - Builtins.y2milestone("device by BUS found %1", oldname) - bus_from_ay = Ops.get( - Builtins.splitstring(Builtins.tostring(oldname), "-"), - 2, - "" - ) - Builtins.y2milestone("BUSID from AY : %1", bus_from_ay) - Builtins.foreach(@hardware) do |hw| - Builtins.y2milestone("hw %1", Ops.get_string(hw, "busid", "")) - if Ops.get_string(hw, "busid", "") == bus_from_ay - Builtins.y2milestone( - "device matched : %1", - Ops.get_string(hw, "dev_name", "") - ) - newname = Ops.get_string(hw, "dev_name", "") - end + case oldname + when /.*-id-#{hw_dev_mac}/i + Builtins.y2milestone("device by ID found: #{oldname}") + newname = hw_dev_name + when /.*-bus-#{hw_dev_busid}/i + Builtins.y2milestone("device by BUS found #{oldname}") + newname = hw_dev_name end end - if oldname == newname - Builtins.y2milestone( - "nothing changed, %1 is old style dev_name", - newname - ) - end + + log = "nothing changed, #{newname} is old style dev_name" + Builtins.y2milestone( log) if oldname == newname + newname end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/yast2-network-3.0.1/src/modules/YaPI/NETWORK.pm new/yast2-network-3.0.7/src/modules/YaPI/NETWORK.pm --- old/yast2-network-3.0.1/src/modules/YaPI/NETWORK.pm 2013-07-30 13:21:05.000000000 +0200 +++ new/yast2-network-3.0.7/src/modules/YaPI/NETWORK.pm 2013-09-23 09:56:51.000000000 +0200 @@ -81,7 +81,7 @@ $configuration{'vendor'} = LanItems->getCurrentItem()->{"hwinfo"}->{"name"}; } - $interfaces{LanItems->interfacename}=\%configuration; + $interfaces{LanItems->GetCurrentName()}=\%configuration; } elsif (LanItems->getCurrentItem()->{'hwinfo'}->{'type'} eq "eth") { my $device = LanItems->getCurrentItem()->{"hwinfo"}->{"dev_name"}; @@ -276,8 +276,8 @@ my @slaves = split(/ /,$ifc->{'bond_slaves'}); for my $i (0 .. scalar(@slaves) -1) { - y2milestone("BONDING_SLAVE$i", @slaves[$i]); - $config{"BONDING_SLAVE$i"} = @slaves[$i]; + y2milestone("BONDING_SLAVE$i", $slaves[$i]); + $config{"BONDING_SLAVE$i"} = $slaves[$i]; } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/yast2-network-3.0.1/test/Makefile.am new/yast2-network-3.0.7/test/Makefile.am --- old/yast2-network-3.0.1/test/Makefile.am 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-network-3.0.7/test/Makefile.am 2013-09-19 18:01:52.000000000 +0200 @@ -0,0 +1,7 @@ +TESTS = \ + netcard_test.rb + +TEST_EXTENSIONS = .rb +RB_LOG_COMPILER = ruby +VERBOSE = 1 +EXTRA_DIST = $(TESTS) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/yast2-network-3.0.1/test/netcard_test.rb new/yast2-network-3.0.7/test/netcard_test.rb --- old/yast2-network-3.0.1/test/netcard_test.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-network-3.0.7/test/netcard_test.rb 2013-09-11 13:26:51.000000000 +0200 @@ -0,0 +1,81 @@ +#! /usr/bin/env ruby + +# hwinfo is based on real hwinfo netcard output +MOCKED_ITEMS = { + # present but unconfigured devices + 0=>{ + "hwinfo"=>{ + "name"=>"Intel Ethernet controller", + "type"=>"eth", + "udi"=>"", + "sysfs_id"=>"/devices/pci0000:00/0000:00:19.0", + "dev_name"=>"eth11", + "requires"=>[], + "modalias"=>"pci:v00008086d00001502sv000017AAsd000021F3bc02sc00i00", + "unique"=>"rBUF.41x4AT4gee2", + "driver"=>"e1000e", + "num"=>0, + "drivers"=>[ + { + "active"=>true, + "modprobe"=>true, + "modules"=>[ + [ + "e1000e", + "" + ] + ] + } + ], + "active"=>true, + "module"=>"e1000e", + "options"=>"", + "bus"=>"pci", + "busid"=>"0000:00:19.0", + "mac"=>"00:01:02:03:04:05", + "link"=>nil, + "wl_channels"=>nil, + "wl_bitrates"=>nil, + "wl_auth_modes"=>nil, + "wl_enc_modes"=>nil + }, + "udev"=>{ + "net"=>[], + "driver"=>"" + } + }, + # devices with configuration, but not present + 1=>{"ifcfg"=>"bond0"}, + 2=>{"ifcfg"=>"eth1"}, + 3=>{"ifcfg"=>"br0"}, + 4=>{"ifcfg"=>"tun0"}, + 5=>{"ifcfg"=>"tap0"} +} + +require "minitest/spec" +require "minitest/autorun" + +require "yast" + +Yast.import "LanItems" + +describe "When querying netcard device name" do + before do + @lan_items = Yast::LanItems + @lan_items.main + + # mocking only neccessary parts of Yast::LanItems so we need not to call + # and mock inputs for Yast::LanItems.Read here + @lan_items.Items = MOCKED_ITEMS + end + + it "returns empty list when querying device name with nil or empty input" do + [ nil, [] ].each { |i| @lan_items.GetDeviceNames( i).must_be_empty } + end + + it "can return list of device names available in the system" do + expected_names = ["bond0", "br0", "eth1", "eth11", "tap0", "tun0"] + + @lan_items.GetNetcardNames.sort.must_equal expected_names + end +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/yast2-network-3.0.1/testsuite/tests/Host-twospaces.out new/yast2-network-3.0.7/testsuite/tests/Host-twospaces.out --- old/yast2-network-3.0.1/testsuite/tests/Host-twospaces.out 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-network-3.0.7/testsuite/tests/Host-twospaces.out 2013-08-26 12:01:51.000000000 +0200 @@ -0,0 +1,7 @@ +Read .target.tmpdir "/tmp" +Dump Read +Read .target.size "/etc/hosts" 1 +Dir .etc.hosts: ["10.0.0.1", "127.0.0.1"] +Read .etc.hosts."10.0.0.1" ["somehost.example.com notice-two-spaces"] +Read .etc.hosts."127.0.0.1" ["localhost localhost.localdomain"] +Return true diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/yast2-network-3.0.1/testsuite/tests/Host-twospaces.rb new/yast2-network-3.0.7/testsuite/tests/Host-twospaces.rb --- old/yast2-network-3.0.1/testsuite/tests/Host-twospaces.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-network-3.0.7/testsuite/tests/Host-twospaces.rb 2013-08-26 12:01:51.000000000 +0200 @@ -0,0 +1,60 @@ +# encoding: utf-8 + +#*************************************************************************** +# +# Copyright (c) 2012 Novell, Inc. +# All Rights Reserved. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of version 2 of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, contact Novell, Inc. +# +# To contact Novell about this file by physical or electronic mail, +# you may find current contact information at www.novell.com +# +#************************************************************************** +module Yast + class HostClient < Client + def main + Yast.include self, "testsuite.rb" + + @READ = { + "target" => { "size" => 1, "tmpdir" => "/tmp" }, + "etc" => { + "hosts" => { + "127.0.0.1" => ["localhost localhost.localdomain"], + "10.0.0.1" => ["somehost.example.com notice-two-spaces"] + } + } + } + + TESTSUITE_INIT([@READ], nil) + + Yast.import "Assert" + Yast.import "Host" + Yast.import "Progress" + Progress.off + + DUMP("Read") + TEST(lambda { Host.Read }, [@READ], nil) + + names = Host.hosts["10.0.0.1"] + Host.Update("", "newname", ["10.0.0.42"]) + + new_names = Host.hosts["10.0.0.1"] + Assert.Equal(names, new_names) + + nil + end + end +end + +Yast::HostClient.new.main -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
