Hello community,

here is the log from the commit of package yast2-network for openSUSE:Factory 
checked in at 2015-10-03 20:28:16
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
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      
2015-09-24 07:15:48.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.yast2-network.new/yast2-network.changes 
2015-10-03 20:29:18.000000000 +0200
@@ -1,0 +2,15 @@
+Thu Oct  1 07:26:55 UTC 2015 - mvid...@suse.com
+
+- Moved "Network Settings" into "System" group also in the Gnome/GTK
+  control center (FATE#318804, bsc#867809).
+- 3.1.131
+
+-------------------------------------------------------------------
+Wed Sep 23 09:06:08 UTC 2015 - mfi...@suse.com
+
+- bnc#866742
+  - Do not fail with internal error when cloning configuration
+    twice in a row
+- 3.1.130
+
+-------------------------------------------------------------------

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

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

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

Other differences:
------------------
++++++ yast2-network.spec ++++++
--- /var/tmp/diff_new_pack.qYBvIe/_old  2015-10-03 20:29:20.000000000 +0200
+++ /var/tmp/diff_new_pack.qYBvIe/_new  2015-10-03 20:29:20.000000000 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           yast2-network
-Version:        3.1.129
+Version:        3.1.131
 Release:        0
 
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build

++++++ yast2-network-3.1.129.tar.bz2 -> yast2-network-3.1.131.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-network-3.1.129/package/yast2-network.changes 
new/yast2-network-3.1.131/package/yast2-network.changes
--- old/yast2-network-3.1.129/package/yast2-network.changes     2015-09-16 
13:17:10.000000000 +0200
+++ new/yast2-network-3.1.131/package/yast2-network.changes     2015-10-01 
13:42:17.000000000 +0200
@@ -1,4 +1,19 @@
 -------------------------------------------------------------------
+Thu Oct  1 07:26:55 UTC 2015 - mvid...@suse.com
+
+- Moved "Network Settings" into "System" group also in the Gnome/GTK
+  control center (FATE#318804, bsc#867809).
+- 3.1.131
+
+-------------------------------------------------------------------
+Wed Sep 23 09:06:08 UTC 2015 - mfi...@suse.com
+
+- bnc#866742
+  - Do not fail with internal error when cloning configuration
+    twice in a row
+- 3.1.130
+
+-------------------------------------------------------------------
 Wed Sep 16 09:06:48 UTC 2015 - mfi...@suse.com
 
 - bnc#945947
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-network-3.1.129/package/yast2-network.spec 
new/yast2-network-3.1.131/package/yast2-network.spec
--- old/yast2-network-3.1.129/package/yast2-network.spec        2015-09-16 
13:17:10.000000000 +0200
+++ new/yast2-network-3.1.131/package/yast2-network.spec        2015-10-01 
13:42:17.000000000 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           yast2-network
-Version:        3.1.129
+Version:        3.1.131
 Release:        0
 
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-network-3.1.129/src/clients/lan_auto.rb 
new/yast2-network-3.1.131/src/clients/lan_auto.rb
--- old/yast2-network-3.1.129/src/clients/lan_auto.rb   2015-09-16 
13:17:10.000000000 +0200
+++ new/yast2-network-3.1.131/src/clients/lan_auto.rb   2015-10-01 
13:42:17.000000000 +0200
@@ -84,7 +84,6 @@
         @ret = Ops.get_string(Lan.Summary("summary"), 0, "")
       elsif @func == "Reset"
         Lan.Import({})
-        LanItems.UnsetModified
         @ret = {}
       elsif @func == "Change"
         @ret = LanAutoSequence("")
@@ -101,7 +100,7 @@
         @ret = true
       elsif @func == "Read"
         @progress_orig = Progress.set(false)
-        @ret = Lan.Read(:cache)
+        @ret = Lan.Read(:nocache)
         Progress.set(@progress_orig)
       elsif @func == "Packages"
         @ret = Lan.AutoPackages
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-network-3.1.129/src/desktop/lan.desktop 
new/yast2-network-3.1.131/src/desktop/lan.desktop
--- old/yast2-network-3.1.129/src/desktop/lan.desktop   2015-09-16 
13:17:10.000000000 +0200
+++ new/yast2-network-3.1.131/src/desktop/lan.desktop   2015-10-01 
13:42:17.000000000 +0200
@@ -1,6 +1,6 @@
 [Desktop Entry]
 Type=Application
-Categories=Settings;System;Qt;X-SuSE-YaST;X-SuSE-YaST-Network;
+Categories=Settings;System;Qt;X-SuSE-YaST;X-SuSE-YaST-System;
 
 X-KDE-ModuleType=Library
 X-KDE-HasReadOnlyMode=true
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-network-3.1.129/src/modules/Lan.rb 
new/yast2-network-3.1.131/src/modules/Lan.rb
--- old/yast2-network-3.1.129/src/modules/Lan.rb        2015-09-16 
13:17:10.000000000 +0200
+++ new/yast2-network-3.1.131/src/modules/Lan.rb        2015-10-01 
13:42:17.000000000 +0200
@@ -664,34 +664,14 @@
     # @param [Hash] settings settings to be imported
     # @return true on success
     def Import(settings)
-      settings = deep_copy(settings)
-      NetworkInterfaces.Import("netcard", Ops.get_map(settings, "devices", {}))
-      Builtins.foreach(NetworkInterfaces.List("netcard")) do |device|
-        LanItems.AddNew
-        Ops.set(LanItems.Items, LanItems.current, "ifcfg" => device)
-      end
-
-      Ops.set(
-        LanItems.autoinstall_settings,
-        "start_immediately",
-        Ops.get_boolean(settings, "start_immediately", false)
-      )
-      Ops.set(
-        LanItems.autoinstall_settings,
-        "strict_IP_check_timeout",
-        Ops.get_integer(settings, "strict_IP_check_timeout", -1)
-      )
-      Ops.set(
-        LanItems.autoinstall_settings,
-        "keep_install_network",
-        Ops.get_boolean(settings, "keep_install_network", false)
-      )
+      settings = {} if settings.nil?
 
-      NetworkConfig.Import(Ops.get_map(settings, "config", {}))
-      DNS.Import(Builtins.eval(Ops.get_map(settings, "dns", {})))
-      Routing.Import(Builtins.eval(Ops.get_map(settings, "routing", {})))
+      LanItems.Import(settings)
+      NetworkConfig.Import(settings["config"] || {})
+      DNS.Import(settings["dns"] || {})
+      Routing.Import(settings["routing"] || {})
 
-      if Ops.get_boolean(settings, "managed", false)
+      if settings["managed"]
         if NetworkService.is_backend_available(:network_manager)
           NetworkService.use_network_manager
         else
@@ -701,11 +681,9 @@
       else
         NetworkService.use_wicked
       end
-      if Builtins.haskey(settings, "ipv6")
-        @ipv6 = Ops.get_boolean(settings, "ipv6", true)
-      end
 
-      LanItems.modified = true
+      @ipv6 = settings.fetch("ipv6", true)
+
       true
     end
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-network-3.1.129/src/modules/LanItems.rb 
new/yast2-network-3.1.131/src/modules/LanItems.rb
--- old/yast2-network-3.1.129/src/modules/LanItems.rb   2015-09-16 
13:17:10.000000000 +0200
+++ new/yast2-network-3.1.131/src/modules/LanItems.rb   2015-10-01 
13:42:17.000000000 +0200
@@ -38,6 +38,8 @@
   # 3. ...
   #
 
+  # FIXME: well this class really is not nice
+  # rubocop:disable ClassLength
   class LanItemsClass < Module
     attr_reader :ipoib_modes
     attr_accessor :ipoib_mode
@@ -59,9 +61,10 @@
       Yast.include self, "network/lan/udev.rb"
       Yast.include self, "network/lan/bridge.rb"
 
+      reset_cache
+
       # Hardware information
       # @see #ReadHardware
-      @Items = {}
       @Hardware = []
       @udev_net_rules = {}
       @driver_options = {}
@@ -70,7 +73,6 @@
       @autoinstall_settings = {}
 
       # Data was modified?
-      @modified = false
       # current selected HW
       @hw = {}
 
@@ -752,13 +754,6 @@
 
       nil
     end
-    # Function sets internal variable, which indicates, that any
-    # settings were modified, to "false"
-    def UnsetModified
-      @modified = false
-
-      nil
-    end
 
     def AddNew
       @current = @Items.to_h.size
@@ -1108,6 +1103,46 @@
       nil
     end
 
+    # Clears internal cache of the module to default values
+    #
+    # TODO: LanItems consists of several sets of internal variables.
+    # 1) cache of items describing network interface
+    # 2) variables used as a kind of iterator in the cache
+    # 3) variables which keeps (some of) attributes of the current item (= item
+    # which is being pointed by the iterator)
+    def reset_cache
+      LanItems.Items = {}
+
+      @modified = false
+    end
+
+    # Imports data from AY profile
+    #
+    # As network related configuration is spread over the whole AY profile's
+    # networking section the function requires hash map with whole AY profile 
hash
+    # representation as returned by LanAutoClient#FromAY profile.
+    #
+    # @param [Hash] AY profile converted into hash
+    # @return [Boolean] on success
+    def Import(settings)
+      reset_cache
+
+      NetworkInterfaces.Import("netcard", settings["devices"] || {})
+      NetworkInterfaces.List("netcard").each do |device|
+        AddNew()
+        LanItems.Items[current] = { "ifcfg" => device }
+      end
+
+      autoinstall_settings["start_immediately"] = 
settings.fetch("start_immediately", false)
+      autoinstall_settings["strict_IP_check_timeout"] = 
settings.fetch("strict_IP_check_timeout", -1)
+      autoinstall_settings["keep_install_network"] = 
settings.fetch("keep_install_network", false)
+
+      # settings == {} has special meaning 'Reset' used by AY
+      SetModified() if !settings.empty?
+
+      true
+    end
+
     def GetDescr
       descr = []
       Builtins.foreach(
@@ -2617,7 +2652,6 @@
     publish function: :WriteUdevRules, type: "void ()"
     publish function: :GetModified, type: "boolean ()"
     publish function: :SetModified, type: "void ()"
-    publish function: :UnsetModified, type: "void ()"
     publish function: :AddNew, type: "void ()"
     publish function: :GetItemModules, type: "list <string> (string)"
     publish function: :GetSlaveCandidates, type: "list <integer> (string, 
boolean (string, integer))"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-network-3.1.129/test/lan_test.rb 
new/yast2-network-3.1.131/test/lan_test.rb
--- old/yast2-network-3.1.129/test/lan_test.rb  2015-09-16 13:17:10.000000000 
+0200
+++ new/yast2-network-3.1.131/test/lan_test.rb  2015-10-01 13:42:17.000000000 
+0200
@@ -133,3 +133,29 @@
     end
   end
 end
+
+describe "LanClass#Import" do
+  it "flushes internal state of LanItems correctly when asked for reset" do
+    AY_PROFILE = {
+      "devices" => {
+        "eth" => {
+          "eth0" => {
+            "BOOTPROTO" => "static",
+            "BROADCAST" => "192.168.127.255",
+            "IPADDR"    => "192.168.73.138",
+            "NETMASK"   => "255.255.192.0",
+            "STARTMODE" => "manual"
+          }
+        }
+      }
+    }
+
+    expect(Yast::Lan.Import(AY_PROFILE)).to be true
+    expect(Yast::LanItems.GetModified).to be true
+    expect(Yast::LanItems.Items).not_to be_empty
+
+    expect(Yast::Lan.Import({})).to be true
+    expect(Yast::LanItems.GetModified).to be false
+    expect(Yast::LanItems.Items).to be_empty
+  end
+end


Reply via email to