Hello community,

here is the log from the commit of package yast2-network for openSUSE:Factory 
checked in at 2020-04-25 20:19:04
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/yast2-network (Old)
 and      /work/SRC/openSUSE:Factory/.yast2-network.new.2738 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "yast2-network"

Sat Apr 25 20:19:04 2020 rev:422 rq:797124 version:4.2.66

Changes:
--------
--- /work/SRC/openSUSE:Factory/yast2-network/yast2-network.changes      
2020-04-05 20:52:21.805114780 +0200
+++ /work/SRC/openSUSE:Factory/.yast2-network.new.2738/yast2-network.changes    
2020-04-25 20:21:01.225118378 +0200
@@ -1,0 +2,8 @@
+Thu Apr 16 07:19:26 UTC 2020 - Knut Anderssen <[email protected]>
+
+- Do not try to install kernel packages anymore since ISDN support
+  was already dropped which was the most common use case. Removed
+  also hardware methods used mainly for ISDN config. (bsc#1151187)
+- 4.2.66
+
+-------------------------------------------------------------------

Old:
----
  yast2-network-4.2.65.tar.bz2

New:
----
  yast2-network-4.2.66.tar.bz2

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ yast2-network.spec ++++++
--- /var/tmp/diff_new_pack.ckwsRe/_old  2020-04-25 20:21:02.249120489 +0200
+++ /var/tmp/diff_new_pack.ckwsRe/_new  2020-04-25 20:21:02.253120497 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           yast2-network
-Version:        4.2.65
+Version:        4.2.66
 Release:        0
 Summary:        YaST2 - Network Configuration
 License:        GPL-2.0-only

++++++ yast2-network-4.2.65.tar.bz2 -> yast2-network-4.2.66.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-network-4.2.65/CONTRIBUTING.md 
new/yast2-network-4.2.66/CONTRIBUTING.md
--- old/yast2-network-4.2.65/CONTRIBUTING.md    2020-04-02 15:02:55.000000000 
+0200
+++ new/yast2-network-4.2.66/CONTRIBUTING.md    1970-01-01 01:00:00.000000000 
+0100
@@ -1,89 +0,0 @@
-YaST Contribution Guidelines
-============================
-
-YaST is an open source project and as such it welcomes all kinds of
-contributions. If you decide to contribute, please follow these guidelines to
-ensure the process is effective and pleasant both for you and the YaST 
maintainers.
-
-There are two main forms of contribution: reporting bugs and performing code
-changes.
-
-Bug Reports
------------
-
-If you find a problem, please report it either using
-[Bugzilla](https://bugzilla.suse.com/enter_bug.cgi?format=guided&product=openSUSE+Factory&component=YaST2)
-or [GitHub issues](../../issues). (For Bugzilla, use the [simplified
-registration](https://secure-www.novell.com/selfreg/jsp/createSimpleAccount.jsp)
-if you don't have an account yet.)
-
-When creating a bug report, please follow our [bug reporting
-guidelines](http://en.opensuse.org/openSUSE:Report_a_YaST_bug).
-
-We can't guarantee that every bug will be fixed, but we'll try.
-
-Code Changes
-------------
-
-We welcome all kinds of code contributions, from simple bug fixes to 
significant
-refactorings and implementation of new features. However, before making any
-non-trivial contribution, get in touch with us first — this can prevent wasted
-effort on both sides. Also, have a look at our [development
-documentation](http://en.opensuse.org/openSUSE:YaST_development).
-
-To send us your code change, use GitHub pull requests. The workflow is as
-follows:
-
-  1. Fork the project.
-
-  2. Create a topic branch based on `master`.
-
-  3. Implement your change, including tests (if possible). Make sure you adhere
-     to the [Ruby style
-     guide](https://github.com/SUSE/style-guides/blob/master/Ruby.md).
-
-  4. Update the package version (in `packages/*.spec`, usually by
-     `rake version:bump`) and add a new entry to the `package/*.changes` file
-     (by `osc vc package`).  
-     For bigger changes or changes which need longer discussion it is advised 
to
-     add this as a separate last commit so it can be easily updated when 
another
-     change is merged in the meantime.
-
-  5. Make sure your change didn't break anything by building the RPM package
-     (`rake osc:build`). The build process includes running the full testsuite.
-
-  6. Publish the branch and create a pull request.
-
-  7. YaST developers will review your change and possibly point out issues.
-     Adapt the code under their guidance until they are all resolved.
-
-  8. Finally, the pull request will get merged or rejected.
-
-See also [GitHub's guide on
-contributing](https://help.github.com/articles/fork-a-repo).
-
-If you want to do multiple unrelated changes, use separate branches and pull
-requests.
-
-### Commits
-
-Each commit in the pull request should do only one thing, which is clearly
-described by its commit message. Especially avoid mixing formatting changes and
-functional changes into one commit. When writing commit messages, adhere to
-[widely used
-conventions](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html).
-
-If your commit is related to a bug in Bugzilla or an issue on GitHub, make sure
-you mention it in the commit message for cross-reference. Use format like
-bnc#775814 or gh#yast/yast-foo#42. See also [GitHub
-autolinking](https://help.github.com/articles/github-flavored-markdown#references)
-and [openSUSE abbreviation
-reference](http://en.opensuse.org/openSUSE:Packaging_Patches_guidelines#Current_set_of_abbreviations).
-
-Additional Information
-----------------------
-
-If you have any question, feel free to ask at the [development mailing
-list](http://lists.opensuse.org/yast-devel/) or at the
-[#yast](http://webchat.freenode.net/?channels=%23yast) IRC channel on freenode.
-We'll do our best to provide a timely and accurate answer.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-network-4.2.65/package/yast2-network.changes 
new/yast2-network-4.2.66/package/yast2-network.changes
--- old/yast2-network-4.2.65/package/yast2-network.changes      2020-04-02 
15:02:55.000000000 +0200
+++ new/yast2-network-4.2.66/package/yast2-network.changes      2020-04-24 
12:58:36.000000000 +0200
@@ -1,4 +1,12 @@
 -------------------------------------------------------------------
+Thu Apr 16 07:19:26 UTC 2020 - Knut Anderssen <[email protected]>
+
+- Do not try to install kernel packages anymore since ISDN support
+  was already dropped which was the most common use case. Removed
+  also hardware methods used mainly for ISDN config. (bsc#1151187)
+- 4.2.66
+
+-------------------------------------------------------------------
 Thu Apr  2 11:33:49 UTC 2020 - Imobach Gonzalez Sosa <[email protected]>
 
 - AutoYaST: Do not try to activate network devices that are already
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-network-4.2.65/package/yast2-network.spec 
new/yast2-network-4.2.66/package/yast2-network.spec
--- old/yast2-network-4.2.65/package/yast2-network.spec 2020-04-02 
15:02:55.000000000 +0200
+++ new/yast2-network-4.2.66/package/yast2-network.spec 2020-04-24 
12:58:36.000000000 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           yast2-network
-Version:        4.2.65
+Version:        4.2.66
 Release:        0
 Summary:        YaST2 - Network Configuration
 License:        GPL-2.0-only
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-network-4.2.65/src/include/network/hardware.rb 
new/yast2-network-4.2.66/src/include/network/hardware.rb
--- old/yast2-network-4.2.65/src/include/network/hardware.rb    2020-04-02 
15:02:55.000000000 +0200
+++ new/yast2-network-4.2.66/src/include/network/hardware.rb    1970-01-01 
01:00:00.000000000 +0100
@@ -1,97 +0,0 @@
-# ***************************************************************************
-#
-# 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
-#
-# **************************************************************************
-# File:  modules/ISDN.ycp
-# Package:  Network configuration
-# Summary:  ISDN data
-# Authors:  Michal Svec  <[email protected]>
-#    Karsten Keil <[email protected]>
-#
-#
-# Representation of the configuration of ISDN.
-# Input and output routines.
-module Yast
-  module NetworkHardwareInclude
-    def initialize_network_hardware(include_target)
-      textdomain "network"
-
-      Yast.import "Arch"
-      Yast.import "Confirm"
-      Yast.import "Map"
-      Yast.include include_target, "network/routines.rb"
-    end
-
-    # Select the given hardware item or clean up structures (item == nil)
-    # @param [Fixnum] which item to be chosen
-    def FindHardware(hardware, which)
-      sel = {}
-
-      if !which.nil?
-        sel = Ops.get_map(hardware, which, {})
-
-        if Ops.greater_than(which, Builtins.size(hardware)) ||
-            Ops.less_than(which, 0)
-          Builtins.y2error(
-            "Item not found in Hardware: %1 (%2)",
-            which,
-            Builtins.size(hardware)
-          )
-        end
-      end
-
-      sel
-    end
-
-    # Select the given hardware item
-    # SelectHardware is a "virtual method", that is named SelectHW in 
"subclasses"
-    # like Lan and Modem.
-    # @param [Hash] sel item to be chosen
-    def SelectHardwareMap(sel)
-      sel = deep_copy(sel)
-      # common stuff
-      @description = Ops.get_string(sel, "name", "")
-      @type = Ops.get_string(sel, "type", "eth")
-      @hotplug = Ops.get_string(sel, "hotplug", "")
-
-      #    unique = sel["udi"]:"";
-      @Requires = Ops.get_list(sel, "requires", [])
-      # #44977: Requires now contain the appropriate kernel packages
-      # but they are handled differently due to multiple kernel flavors
-      # (see Package::InstallKernel)
-      # Leave only those not starting with "kernel".
-      @Requires = Builtins.filter(@Requires) do |r|
-        Builtins.search(r, "kernel") != 0
-      end
-      Builtins.y2milestone("requires=%1", @Requires)
-
-      # FIXME: devname
-      @hotplug = ""
-
-      deep_copy(sel)
-    end
-
-    # Select the given hardware item or clean up structures (item == nil)
-    # @param [Fixnum] which item to be chosen
-    def SelectHardware(hardware, which)
-      SelectHardwareMap(FindHardware(hardware, which))
-    end
-  end
-end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-network-4.2.65/src/lib/y2network/hwinfo.rb 
new/yast2-network-4.2.66/src/lib/y2network/hwinfo.rb
--- old/yast2-network-4.2.65/src/lib/y2network/hwinfo.rb        2020-04-02 
15:02:55.000000000 +0200
+++ new/yast2-network-4.2.66/src/lib/y2network/hwinfo.rb        2020-04-24 
12:58:36.000000000 +0200
@@ -34,7 +34,6 @@
     def netcards
       return @netcards if @netcards
 
-      read_hardware
       @netcards = ReadHardware("netcard").map do |attrs|
         name = attrs["dev_name"]
         extra_attrs = name.to_s.empty? ? {} : extra_attrs_for(name)
@@ -56,13 +55,6 @@
       extra["dev_port"] = raw_dev_port unless raw_dev_port.empty?
       extra
     end
-
-    # Makes sure that the hardware information was read
-    def read_hardware
-      Yast.import "LanItems"
-
-      Yast::LanItems.ReadHw if Yast::LanItems.Hardware.empty?
-    end
   end
 
   # Stores useful (from networking POV) items of hwinfo for an interface.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-network-4.2.65/src/modules/Lan.rb 
new/yast2-network-4.2.66/src/modules/Lan.rb
--- old/yast2-network-4.2.65/src/modules/Lan.rb 2020-04-02 15:02:55.000000000 
+0200
+++ new/yast2-network-4.2.66/src/modules/Lan.rb 2020-04-24 12:58:36.000000000 
+0200
@@ -606,7 +606,7 @@
 
     # Convert data from autoyast to structure used by module.
     # @param [Hash] input autoyast settings
-    # @return native network settings
+    # @return [Hash] native network settings
     # FIXME: massive refactoring required
     def FromAY(input)
       input = deep_copy(input)
@@ -641,7 +641,7 @@
 
     # Import data.
     # It expects data described networking.rnc
-    # and then passed through {Lan#FromAY}.
+    # and then passed through {#FromAY}.
     # Most prominently, instead of a flat list called "interfaces"
     # we import a 2-level map of typed "devices"
     # @param [Hash] settings settings to be imported
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-network-4.2.65/src/modules/LanItems.rb 
new/yast2-network-4.2.66/src/modules/LanItems.rb
--- old/yast2-network-4.2.65/src/modules/LanItems.rb    2020-04-02 
15:02:55.000000000 +0200
+++ new/yast2-network-4.2.66/src/modules/LanItems.rb    2020-04-24 
12:58:36.000000000 +0200
@@ -100,8 +100,6 @@
       @tunnel_set_owner = ""
       @tunnel_set_group = ""
 
-      Yast.include self, "network/hardware.rb"
-
       # this is the map of kernel modules vs. requested firmware
       # non-empty keys are firmware packages shipped by SUSE
       @request_firmware = 
YAML.load_file(Directory.find_data_file("network/firmwares.yml"))
@@ -162,13 +160,6 @@
       current_name_for(@current)
     end
 
-    # Return the current device names
-    #
-    # @ return [Array<String>]
-    def current_device_names
-      GetNetcardInterfaces().map { |i| current_name_for(i) }.reject(&:empty?)
-    end
-
     # Returns device type for particular lan item
     #
     # @param itemId [Integer] a key for {#Items}
@@ -185,36 +176,6 @@
       NetworkInterfaces.devmap(GetDeviceName(itemId))
     end
 
-    def GetCurrentMap
-      GetDeviceMap(@current)
-    end
-
-    # Sets item's sysconfig device map to given one
-    #
-    # It updates NetworkInterfaces according given map. Map is expected
-    # to be a hash where both key even value are strings
-    #
-    # @param item_id [Integer] a key for {#Items}
-    def SetDeviceMap(item_id, devmap)
-      devname = GetDeviceName(item_id)
-      return false if devname.nil? || devname.empty?
-
-      NetworkInterfaces.Change2(devname, devmap, false)
-    end
-
-    # Sets one option in items sysconfig device map
-    #
-    # Currently no checks on sysconfig option validity are performed
-    #
-    # @param item_id [Integer] a key for {#Items}
-    def SetItemSysconfigOpt(item_id, opt, value)
-      devmap = GetDeviceMap(item_id)
-      return false if devmap.nil?
-
-      devmap[opt] = value
-      SetDeviceMap(item_id, devmap)
-    end
-
     # Function which returns if the settings were modified
     # @return [Boolean]  settings were modified
     def GetModified
@@ -237,11 +198,6 @@
       Items().keys
     end
 
-    # Creates list of names of all known netcards configured even unconfigured
-    def GetNetcardNames
-      GetDeviceNames(GetNetcardInterfaces())
-    end
-
     # Finds all items of given device type
     #
     # @param type [String] device type
@@ -261,15 +217,6 @@
       find_by_sysconfig { |ifcfg| dhcp?(ifcfg) }
     end
 
-    # Find all NICs configured statically
-    #
-    # @return [Array<String>] list of NIC names which have a static config
-    def find_static_ifaces
-      find_by_sysconfig do |ifcfg|
-        ifcfg.fetch("BOOTPROTO", "").match(/static/i)
-      end
-    end
-
     # Finds all devices which has DHCLIENT_SET_HOSTNAME set to "yes"
     #
     # @return [Array<String>] list of NIC names which has the option set to 
"yes"
@@ -299,70 +246,6 @@
       invalid_dhcp_cfgs.empty?
     end
 
-    # Get list of all configured interfaces
-    #
-    # @param type [String] only obtains configured interfaces of the given type
-    # return [Array] list of strings - interface names (eth0, ...)
-    # FIXME: rename e.g. to configured_interfaces
-    def getNetworkInterfaces(type = nil)
-      configurations = NetworkInterfaces.FilterDevices("netcard")
-      devtypes = type ? [type] : 
NetworkInterfaces.CardRegex["netcard"].to_s.split("|")
-
-      devtypes.inject([]) do |acc, conf_type|
-        conf = configurations[conf_type].to_h
-        acc.concat(conf.keys)
-      end
-    end
-
-    # Finds item_id by device name
-    #
-    # If an item is associated with config file of given name (ifcfg-<device>)
-    # then its id is returned
-    #
-    # @param [String] device name (e.g. eth0)
-    # @return index in Items or nil
-    def find_configured(device)
-      @Items.select { |_k, v| v["ifcfg"] == device }.keys.first
-    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
-    #
-    # @return [String] new style name in case of success. Given name otherwise.
-    def getDeviceName(oldname)
-      newname = oldname
-
-      hardware = ReadHardware("netcard")
-
-      hardware.each do |hw|
-        hw_dev_name = hw["dev_name"] || ""
-        hw_dev_mac = hw["permanent_mac"] || hw["mac"] || ""
-        hw_dev_busid = hw["busid"] || ""
-
-        case oldname
-        when /.*-id-#{hw_dev_mac}/i
-          log.info("device by ID found: #{oldname}")
-          newname = hw_dev_name
-        when /.*-bus-#{hw_dev_busid}/i
-          log.info("device by BUS found #{oldname}")
-          newname = hw_dev_name
-        end
-      end
-
-      log.info("nothing changed, #{newname} is old style dev_name") if oldname 
== newname
-
-      newname
-    end
-
-    # preinitializates @Items according info on physically detected network 
cards
-    def ReadHw
-      @Items = {}
-      @Hardware = ReadHardware("netcard")
-      nil
-    end
-
     # Clears internal cache of the module to default values
     #
     # TODO: LanItems consists of several sets of internal variables.
@@ -407,43 +290,6 @@
       true
     end
 
-    # Creates details for device's overview based on ip configuration type
-    #
-    # Produces list of strings. Strings are intended for "bullet" list, e.g.:
-    # * <string1>
-    # * <string2>
-    #
-    # @param [Hash] dev_map a device's sysconfig map (in form "option" => 
"value")
-    # @return [Array] list of strings, one string is intended for one "bullet"
-    def ip_overview(dev_map)
-      bullets = []
-
-      ip = DeviceProtocol(dev_map)
-
-      if ip =~ /DHCP/
-        bullets << format("%s %s", _("IP address assigned using"), ip)
-      elsif IP.Check(ip)
-        prefixlen = dev_map["PREFIXLEN"] || ""
-        if !prefixlen.empty?
-          bullets << format(_("IP address: %s/%s"), ip, prefixlen)
-        else
-          subnetmask = dev_map["NETMASK"]
-          bullets << format(_("IP address: %s, subnet mask %s"), ip, 
subnetmask)
-        end
-      end
-
-      # build aliases overview
-      item_aliases = dev_map["_aliases"] || {}
-      if !item_aliases.empty? && !NetworkService.is_network_manager
-        item_aliases.each do |_key2, desc|
-          parameters = format("%s/%s", desc["IPADDR"], desc["PREFIXLEN"])
-          bullets << format("%s (%s)", desc["LABEL"], parameters)
-        end
-      end
-
-      bullets
-    end
-
     # Is current device hotplug or not? I.e. is connected via usb/pcmci?
     def isCurrentHotplug
       hotplugtype = Ops.get_string(getCurrentItem, ["hwinfo", "hotplug"], "")
@@ -496,177 +342,6 @@
       true
     end
 
-    def SetItem(*)
-      @hotplug = ""
-      Builtins.y2debug("type=%1", @type)
-      @type = Builtins.regexpsub(@type, "([^-]+)-.*$", "\\1") if 
Builtins.issubstring(@type, "-")
-      Builtins.y2debug("type=%1", @type)
-
-      nil
-    end
-
-    # Creates eth emulation for s390 devices
-    #
-    # @param dev_attrs [Hash] an s390 device description (e.g. as obtained 
from AY profile).
-    # If it contains s390 device attributes definition, then these definitions 
takes
-    # precendence over values assigned to corresponding LanItems' global 
variables
-    # before the method invocation. Hash keys are strings named after LanItems'
-    # s390 globals.
-    def createS390Device(dev_attrs = {})
-      Builtins.y2milestone("creating device s390 network device, #{dev_attrs}")
-
-      # FIXME: leftover from dropping LanUdevAuto module. This was its way how 
to
-      # configure s390 specific globals. When running in "normal" mode these 
attributes
-      # are initialized elsewhere (see S390Dialog in 
include/network/lan/hardware.rb)
-      if !dev_attrs.empty?
-        Select("")
-        @type = dev_attrs["type"] || ""
-        @qeth_chanids = dev_attrs["chanids"] || ""
-        @qeth_layer2 = dev_attrs.fetch("layer2", false)
-        @chan_mode = dev_attrs["protocol"] || ""
-        @iucv_user = dev_attrs["router"] || ""
-      end
-
-      result = true
-      # command to create device
-      command1 = ""
-      # command to find created device
-      command2 = ""
-      case @type
-      when "hsi", "qeth"
-        @portnumber_param = if 
Ops.greater_than(Builtins.size(@qeth_portnumber), 0)
-          Builtins.sformat("-n %1", @qeth_portnumber.to_s.shellescape)
-        else
-          ""
-        end
-        @options_param = if Ops.greater_than(Builtins.size(@qeth_options), 0)
-          Builtins.sformat("-o %1", @qeth_options.shellescape)
-        else
-          ""
-        end
-        command1 = Builtins.sformat(
-          "/sbin/qeth_configure %1 %2 %3 %4 %5 1",
-          @options_param,
-          @qeth_layer2 ? "-l" : "",
-          @portnumber_param,
-          @qeth_chanids
-        )
-        command2 = Builtins.sformat(
-          "/usr/bin/ls /sys/devices/qeth/%1/net/ | /usr/bin/head -n1 | 
/usr/bin/tr -d '\n'",
-          Ops.get(Builtins.splitstring(@qeth_chanids, " "), 0, "")
-        )
-      when "ctc"
-        # chan_ids (read, write), protocol
-        command1 = Builtins.sformat(
-          "/sbin/ctc_configure %1 1 %2",
-          @qeth_chanids,
-          @chan_mode.shellescape
-        )
-        command2 = Builtins.sformat(
-          "/usr/bin/ls /sys/devices/ctcm/%1/net/ | /usr/bin/head -n1 | 
/usr/bin/tr -d '\n'",
-          Ops.get(Builtins.splitstring(@qeth_chanids, " "), 0, "").shellescape
-        )
-      when "lcs"
-        # chan_ids (read, write), protocol
-        command1 = Builtins.sformat(
-          "/sbin/ctc_configure %1 1 %2",
-          @qeth_chanids,
-          @chan_mode.shellescape
-        )
-        command2 = Builtins.sformat(
-          "/usr/bin/ls /sys/devices/lcs/%1/net/ | /usr/bin/head -n1 | 
/usr/bin/tr -d '\n'",
-          Ops.get(Builtins.splitstring(@qeth_chanids, " "), 0, "").shellescape
-        )
-      when "iucv"
-        # router
-        command1 = Builtins.sformat("/sbin/iucv_configure %1 1", 
@iucv_user.shellescape)
-        command2 = Builtins.sformat(
-          "/usr/bin/ls /sys/devices/%1/*/net/ | /usr/bin/head -n1 | 
/usr/bin/tr -d '\n'",
-          @type.shellescape
-        )
-      else
-        Builtins.y2error("Unsupported type : %1", @type)
-      end
-      Builtins.y2milestone("execute %1", command1)
-      output1 = SCR.Execute(path(".target.bash_output"), command1)
-      if Ops.get_integer(output1, "exit", -1) == 0 &&
-          Builtins.size(Ops.get_string(output1, "stderr", "")) == 0
-        Builtins.y2milestone("Success : %1", output1)
-      else
-        Builtins.y2error("Problem occured : %1", output1)
-        result = false
-      end
-      Builtins.y2milestone("output1 %1", output1)
-
-      if result
-        Builtins.y2milestone("command2 %1", command2)
-        output2 = Convert.convert(
-          SCR.Execute(path(".target.bash_output"), command2),
-          from: "any",
-          to:   "map <string, any>"
-        )
-        Builtins.y2milestone("output2 %1", output2)
-        if Ops.get_integer(output2, "exit", -1) == 0 &&
-            Builtins.size(Ops.get_string(output2, "stderr", "")) == 0
-          Ops.set(
-            @Items,
-            [@current, "ifcfg"],
-            Ops.get_string(output2, "stdout", "")
-          )
-          Ops.set(
-            @Items,
-            [@current, "hwinfo", "dev_name"],
-            Ops.get_string(output2, "stdout", "")
-          )
-          Builtins.y2milestone(
-            "Device %1 created",
-            Ops.get_string(output2, "stdout", "")
-          )
-        else
-          Builtins.y2error("Some problem occured : %1", output2)
-          result = false
-        end
-      end
-
-      result
-    end
-
-    #  Creates a list of udev rules for old style named interfaces
-    #
-    #  It takes a whole "interfaces" section of AY profile and produces
-    #  a list of udev rules to guarantee device naming persistency.
-    #  The rule is base on attributes described in old style name
-    #
-    #  @param [Array] list of hashes describing interfaces in AY profile
-    #  @return [Array] list of hashes for udev rules
-    def createUdevFromIfaceName(interfaces)
-      return [] if !interfaces || interfaces.empty?
-
-      udev_rules = []
-      attr_map = {
-        "id"  => "ATTR{address}",
-        "bus" => "KERNELS"
-      }
-
-      # rubocop:disable Next
-      # the check is disabled bcs the code uses capture groups. Rewriting
-      # the code would require some tricks to access these groups
-      interfaces.each do |interface|
-        if /.*-(?<attr>id|bus)-(?<value>.*)/ =~ interface["device"]
-          udev_rules << {
-            "rule"  => attr_map[attr],
-            "value" => value,
-            "name"  => getDeviceName(interface["device"])
-          }
-        end
-      end
-      # rubocop:enable Next
-
-      log.info("converted interfaces: #{interfaces}")
-
-      udev_rules
-    end
-
     # Returns unused name for device of given type
     #
     # When already having eth0, eth1, enp0s3 devices (eth type) and asks for 
new
@@ -829,12 +504,10 @@
     publish function: :GetDeviceMap, type: "map <string, any> (integer)"
     publish function: :GetModified, type: "boolean ()"
     publish function: :SetModified, type: "void ()"
-    publish function: :ReadHw, type: "void ()"
     publish function: :Read, type: "void ()"
     publish function: :isCurrentHotplug, type: "boolean ()"
     publish function: :isCurrentDHCP, type: "boolean ()"
     publish function: :Commit, type: "boolean ()"
-    publish function: :createS390Device, type: "boolean ()"
     publish function: :find_dhcp_ifaces, type: "list <string> ()"
   end
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-network-4.2.65/src/modules/NetHwDetection.rb 
new/yast2-network-4.2.66/src/modules/NetHwDetection.rb
--- old/yast2-network-4.2.65/src/modules/NetHwDetection.rb      2020-04-02 
15:02:55.000000000 +0200
+++ new/yast2-network-4.2.66/src/modules/NetHwDetection.rb      2020-04-24 
12:58:36.000000000 +0200
@@ -55,6 +55,7 @@
 # </ul>
 #
 require "yast"
+require "yast2/execute"
 require "shellwords"
 
 module Yast
@@ -67,17 +68,7 @@
       Yast.import "Package"
       Yast.import "String"
 
-      # yuck, FIXME
-      # this is here just because network/hardware.ycp references it
-      # because of detection and module loading (StartEthInterface)
-      # general stuff
-      @description = ""
-      @type = ""
-      @unique = ""
-      @hotplug = ""
-      @Requires = []
-
-      Yast.include self, "network/hardware.rb"
+      Yast.include self, "network/routines.rb"
 
       # Detection result
       # (in dhcpcd-<i>interface</i>.info format)
@@ -95,50 +86,17 @@
     # WATCH OUT, this is the place where modules are loaded
     # @return true if success
     def LoadNetModules
-      Builtins.y2milestone("Network detection prepare")
+      log.info "Network detection prepare"
 
       hardware = ReadHardware("netcard")
 
-      Builtins.y2debug("Hardware=%1", hardware)
-      return false if Ops.less_than(Builtins.size(hardware), 1)
+      log.debug("Hardware=#{hardware.inspect}")
+      return false if hardware.empty?
 
-      needed_modules = Builtins.listmap(hardware) do |h|
-        # Formerly we simply modprobed the first module of the first
-        # driver, if it was not already loaded.  But if the user
-        # configured the card to use the second driver and unloads it
-        # and wants to load the first, it will not work because the
-        # first driver is already loaded but not bound to the device
-        # (the second one took it). N#59794#c31
-        # We will only load a driver if there's no driver for the card active.
-        active_driver = Builtins.find(Ops.get_list(h, "drivers", [])) do |d|
-          Ops.get_boolean(d, "active", false)
-        end
-        { Ops.get_string(h, "module", "") => active_driver.nil? }
-        # TODO: list of todos
-        # 1: choose which driver to load
-        # 2: load all its modules: no cards use multiple modules
-        # 3: either modprobe or insmod: ISA history
-      end
-      needed_modules = Builtins.filter(needed_modules) do |m, load|
-        load && !m.nil? && m != "" &&
-          SCR.Execute(
-            path(".target.bash"),
-            Builtins.sformat("/usr/bin/grep ^%1 /proc/modules", m.shellescape)
-          ) != 0
-      end
-      @detection_modules = Builtins.maplist(needed_modules) { |m, _a| m }
-      Package.InstallKernel(Builtins.maplist(@detection_modules) do |m|
-        Ops.add(m, ".ko")
-      end)
-      Builtins.foreach(@detection_modules) do |mod|
-        Builtins.y2milestone("Loading module: %1", mod)
-        SCR.Execute(
-          path(".target.bash"),
-          Builtins.sformat("/usr/sbin/modprobe --use-blacklist %1 2>&1", 
mod.shellescape)
-        )
-      end
+      @detection_modules = needed_modules(hardware).dup
+      @detection_modules.each { |name| load_module(name) }
 
-      Builtins.y2milestone("Network detection prepare (end)")
+      log.info("Network detection prepare (end)")
 
       true
     end
@@ -246,17 +204,59 @@
       String.CutBlanks(hnent)
     end
 
-    publish variable: :description, type: "string"
-    publish variable: :type, type: "string"
-    publish variable: :unique, type: "string"
-    publish variable: :hotplug, type: "string"
-    publish variable: :Requires, type: "list <string>"
     publish variable: :result, type: "map"
     publish variable: :running, type: "boolean"
     publish function: :Start, type: "boolean ()"
     publish function: :Stop, type: "boolean ()"
     publish function: :DuplicateIP, type: "boolean (string)"
     publish function: :ResolveIP, type: "string (string)"
+
+  private
+
+    # Check which modules need to be modprobed returning the ones which are not
+    # active according to hwinfo and which are still not loaded
+    #
+    # @param netcards_hwinfo [Array<Hash>] network devices info
+    # @return [Array<String>]
+    def needed_modules(netcards_hwinfo)
+      netcards_hwinfo.each_with_object([]) do |h, modules|
+        name = h.fetch("module", "")
+        next if name.empty?
+
+        modules << name if !active_driver?(h) && !already_loaded?(name)
+      end
+    end
+
+    # Convenience method to check whether a given module is already loaded or
+    # not
+    #
+    # @param name [String] module name
+    # @return [Boolean] whether a given module is already loaded or not
+    def already_loaded?(name)
+      cmd = ["/usr/bin/grep", "^#{name}", "/proc/modules"]
+
+      _output, status = Yast::Execute.stdout.on_target(*cmd, 
allowed_exitstatus: 0..255)
+      status&.zero?
+    end
+
+    # Convenience method to check wheter a driver is already active or not
+    # according to the given hwinfo
+    #
+    # @param netcard_hwinfo [Array<Hash>] netcard hardware info
+    # @return [Boolean] whether the netcard driver is active or not
+    def active_driver?(netcard_hwinfo)
+      netcard_hwinfo.fetch("drivers", []).any? { |d| d["active"] }
+    end
+
+    # Convenience method to modprobe the given module
+    #
+    # @param name [String] module to be modprobed
+    def load_module(name)
+      cmd = ["/usr/sbin/modprobe", "--use-blacklist", name]
+
+      log.info("Loading module: #{name}")
+      Yast::Execute.stdout.on_target(*cmd, allowed_exitstatus: 0..1)
+    end
   end
 
   NetHwDetection = NetHwDetectionClass.new
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-network-4.2.65/test/build_lan_overview_test.rb 
new/yast2-network-4.2.66/test/build_lan_overview_test.rb
--- old/yast2-network-4.2.65/test/build_lan_overview_test.rb    2020-04-02 
15:02:55.000000000 +0200
+++ new/yast2-network-4.2.66/test/build_lan_overview_test.rb    1970-01-01 
01:00:00.000000000 +0100
@@ -1,40 +0,0 @@
-#!/usr/bin/env rspec
-
-# Copyright (c) [2019] SUSE LLC
-#
-# 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 SUSE LLC.
-#
-# To contact SUSE LLC about this file by physical or electronic mail, you may
-# find current contact information at www.suse.com.
-
-require_relative "test_helper"
-
-require "yast"
-
-Yast.import "LanItems"
-
-describe "LanItemsClass#ip_overview" do
-  # smoke test for bnc#1013684
-  it "do not crash when devmap for staticaly configured device do not contain 
PREFIXLEN" do
-    devmap = {
-      "IPADDR"    => "1.1.1.1",
-      "NETMASK"   => "255.255.0.0",
-      "BOOTPROTO" => "static",
-      "STARTMODE" => "auto"
-    }
-
-    expect { Yast::LanItems.ip_overview(devmap) }.not_to raise_error
-  end
-end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-network-4.2.65/test/lan_items_helpers_test.rb 
new/yast2-network-4.2.66/test/lan_items_helpers_test.rb
--- old/yast2-network-4.2.65/test/lan_items_helpers_test.rb     2020-04-02 
15:02:55.000000000 +0200
+++ new/yast2-network-4.2.66/test/lan_items_helpers_test.rb     2020-04-24 
12:58:36.000000000 +0200
@@ -50,71 +50,6 @@
   end
 end
 
-describe "LanItemsClass#getNetworkInterfaces" do
-  NETCONFIG_ITEMS = {
-    "eth"  => {
-      "eth1" => { "BOOTPROTO" => "none" },
-      "eth2" => { "BOOTPROTO" => "none" },
-      "eth4" => {
-        "BOOTPROTO" => "static",
-        "IPADDR"    => "0.0.0.0",
-        "PREFIX"    => "32"
-      },
-      "eth5" => { "BOOTPROTO" => "static", "STARTMODE" => "nfsroot" },
-      "eth6" => { "BOOTPROTO" => "static", "STARTMODE" => "ifplugd" }
-    },
-    "tun"  => {
-      "tun0" => {
-        "BOOTPROTO" => "static",
-        "STARTMODE" => "onboot",
-        "TUNNEL"    => "tun"
-      }
-    },
-    "tap"  => {
-      "tap0" => {
-        "BOOTPROTO" => "static",
-        "STARTMODE" => "onboot",
-        "TUNNEL"    => "tap"
-      }
-    },
-    "br"   => {
-      "br0" => { "BOOTPROTO" => "dhcp" }
-    },
-    "bond" => {
-      "bond0" => {
-        "BOOTPROTO"      => "static",
-        "BONDING_MASTER" => "yes",
-        "BONDING_SLAVE0" => "eth1",
-        "BONDING_SLAVE1" => "eth2"
-      }
-    }
-  }.freeze
-
-  EXPECTED_INTERFACES = [
-    "eth1",
-    "eth2",
-    "eth4",
-    "eth5",
-    "eth6",
-    "tun0",
-    "tap0",
-    "br0",
-    "bond0"
-  ].freeze
-
-  it "returns list of known interfaces" do
-    allow(Yast::NetworkInterfaces).to receive(:FilterDevices) { 
NETCONFIG_ITEMS }
-    expect(Yast::LanItems.getNetworkInterfaces).to 
match_array(EXPECTED_INTERFACES)
-  end
-
-  context "when a type is given" do
-    it "returns the list of known interfaces of the given type" do
-      allow(Yast::NetworkInterfaces).to receive(:FilterDevices) { 
NETCONFIG_ITEMS }
-      expect(Yast::LanItems.getNetworkInterfaces("br")).to eql(["br0"])
-    end
-  end
-end
-
 describe "LanItems#find_type_ifaces" do
   let(:mocked_items) do
     {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-network-4.2.65/test/lan_udev_auto_test.rb 
new/yast2-network-4.2.66/test/lan_udev_auto_test.rb
--- old/yast2-network-4.2.65/test/lan_udev_auto_test.rb 2020-04-02 
15:02:55.000000000 +0200
+++ new/yast2-network-4.2.66/test/lan_udev_auto_test.rb 1970-01-01 
01:00:00.000000000 +0100
@@ -1,95 +0,0 @@
-#!/usr/bin/env rspec
-
-# Copyright (c) [2019] SUSE LLC
-#
-# 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 SUSE LLC.
-#
-# To contact SUSE LLC about this file by physical or electronic mail, you may
-# find current contact information at www.suse.com.
-
-require_relative "test_helper"
-
-require "yast"
-
-describe "LanItems#getDeviceName" do
-  Yast.import "LanItems"
-
-  NEW_STYLE_NAME = "spec0".freeze
-  MAC_BASED_NAME = "spec-id-00:11:22:33:44:FF".freeze
-  BUS_BASED_NAME = "spec-bus-0000:00:19.0".freeze
-
-  LCASE_MAC_NAME = "spec-id-00:11:22:33:44:ff".freeze
-
-  UNKNOWN_MAC_NAME = "spec-id-00:00:00:00:00:00".freeze
-  UNKNOWN_BUS_NAME = "spec-bus-0000:00:00.0".freeze
-
-  INVALID_NAME = "some funny string".freeze
-
-  subject(:lan_items) { Yast::LanItems }
-
-  # general mocking stuff is placed here
-  before(:each) do
-    # mock devices configuration
-    allow(lan_items).to receive(:ReadHardware) {
-      [
-        {
-          "dev_name"      => NEW_STYLE_NAME,
-          "mac"           => "00:11:22:33:44:FF",
-          "permanent_mac" => "00:11:22:33:44:FF",
-          "busid"         => "0000:00:19.0"
-        }
-      ]
-    }
-  end
-
-  context "when new style name is provided" do
-    it "returns the new style name" do
-      expect(lan_items.getDeviceName(NEW_STYLE_NAME)).to be_equal 
NEW_STYLE_NAME
-    end
-  end
-
-  context "when old fashioned mac based name is provided" do
-    it "returns corresponding new style name" do
-      expect(lan_items.getDeviceName(MAC_BASED_NAME)).to be_equal 
NEW_STYLE_NAME
-    end
-
-    it "returns same result despite of letter case in mac" do
-      expect(
-        lan_items.getDeviceName(LCASE_MAC_NAME)
-      ).to be_equal lan_items.getDeviceName(MAC_BASED_NAME)
-    end
-
-    it "returns given name if no known device is matched" do
-      expect(lan_items.getDeviceName(UNKNOWN_MAC_NAME)).to be_equal 
UNKNOWN_MAC_NAME
-    end
-  end
-
-  context "when old fashioned bus id based name is provided" do
-    it "returns corresponding new style name" do
-      expect(lan_items.getDeviceName(BUS_BASED_NAME)).to be_equal 
NEW_STYLE_NAME
-    end
-
-    it "returns given name if no known device is matched" do
-      expect(lan_items.getDeviceName(UNKNOWN_MAC_NAME)).to be_equal 
UNKNOWN_MAC_NAME
-    end
-  end
-
-  context "when provided invalid input" do
-    # TODO: should raise an exception in future
-    it "returns given input" do
-      expect(lan_items.getDeviceName(INVALID_NAME)).to be_equal INVALID_NAME
-    end
-  end
-end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-network-4.2.65/test/net_hw_detection_test.rb 
new/yast2-network-4.2.66/test/net_hw_detection_test.rb
--- old/yast2-network-4.2.65/test/net_hw_detection_test.rb      1970-01-01 
01:00:00.000000000 +0100
+++ new/yast2-network-4.2.66/test/net_hw_detection_test.rb      2020-04-24 
12:58:36.000000000 +0200
@@ -0,0 +1,96 @@
+#!/usr/bin/env rspec
+
+# Copyright (c) [2020] SUSE LLC
+#
+# 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 SUSE LLC.
+#
+# To contact SUSE LLC about this file by physical or electronic mail, you may
+# find current contact information at www.suse.com.
+
+require_relative "test_helper"
+
+Yast.import "NetHwDetection"
+
+describe "NetHwDetection" do
+  subject { Yast::NetHwDetection }
+  let(:hwinfo) { [] }
+
+  before do
+    allow(subject).to receive(:ReadHardware).with("netcard").and_return(hwinfo)
+  end
+
+  describe "#LoadNetModules" do
+    it "reads the hwinfo of the network cards present in the system" do
+      expect(subject).to receive(:ReadHardware).with("netcard")
+      subject.LoadNetModules
+    end
+
+    context "when the system does not have network cards" do
+      it "returns false" do
+        expect(subject.LoadNetModules).to eq(false)
+      end
+    end
+
+    context "when there is some network card which driver is not active" do
+      let(:loaded) { true }
+
+      before do
+        allow(subject).to 
receive(:already_loaded?).with("qeth").and_return(loaded)
+      end
+
+      let(:hwinfo) do
+        [
+          {
+            "active" => false, "bus" => "none", "busid" => "", "dev_name" => 
"", "driver" => "",
+            "drivers" => [{ "active" => false, "modprobe" => true, "modules" 
=> [["qeth", ""]] }],
+            "link" => nil, "mac" => "", "modalias" => "", "module" => "qeth",
+            "name" => "OSA Express Network card", "num" => 0, "options" => "",
+            "permanent_mac" => "", "requires" => [], "sysfs_id" => "", "type" 
=> "qeth",
+            "udi" => "", "unique" => "rdCR.n_7QNeEnh23", "wl_auth_modes" => 
nil,
+            "wl_bitrates" => nil, "wl_channels" => nil, "wl_enc_modes" => nil
+          },
+          {
+            "active" => true, "bus" => "Virtio", "busid" => "virtio0", 
"dev_name" => "eth0",
+            "drivers" => [
+              { "active" => true, "modprobe" => true, "modules" => 
[["virtio_net", ""]] }
+            ], "driver" => "virtio_net", "link" => false, "mac" => 
"52:54:00:12:34:56",
+            "modalias" => "virtio:d00000001v00001AF4", "module" => 
"virtio_net",
+            "name" => "Ethernet Card 0", "num" => 1, "options" => "",
+            "parent_busid" => "0000:00:02.0", "permanent_mac" => 
"52:54:00:12:34:56",
+            "requires" => [], "sysfs_id" => "/devices/pci0000:00/0000:00 
=>02.0/virtio0",
+            "type" => "eth", "udi" => "", "unique" => "Prmq.VIRhsc57kTD", 
"wl_auth_modes" => nil,
+            "wl_bitrates" => nil, "wl_channels" => nil, "wl_enc_modes" => nil
+          }
+        ]
+      end
+
+      context "and the driver module is not loaded" do
+        let(:loaded) { false }
+
+        it "modprobes the inactive driver" do
+          expect(subject).to receive(:load_module).with("qeth")
+          subject.LoadNetModules
+        end
+      end
+
+      context "and the driver was already loaded" do
+        it "does not try to modprobe the module" do
+          expect(subject).to_not receive(:load_module)
+          subject.LoadNetModules
+        end
+      end
+    end
+  end
+end


Reply via email to