Hello community,

here is the log from the commit of package yast2 for openSUSE:Leap:15.2 checked 
in at 2020-04-17 13:36:34
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Leap:15.2/yast2 (Old)
 and      /work/SRC/openSUSE:Leap:15.2/.yast2.new.2738 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "yast2"

Fri Apr 17 13:36:34 2020 rev:181 rq:793938 version:4.2.82

Changes:
--------
--- /work/SRC/openSUSE:Leap:15.2/yast2/yast2.changes    2020-04-14 
14:20:31.249253875 +0200
+++ /work/SRC/openSUSE:Leap:15.2/.yast2.new.2738/yast2.changes  2020-04-17 
13:36:35.772177128 +0200
@@ -1,0 +2,7 @@
+Mon Apr 13 12:36:58 UTC 2020 - Knut Anderssen <kanders...@suse.com>
+
+- Remove ip aliases that were marked to be deleted from the
+  interface configuration files (bsc#1146020)
+- 4.2.82
+
+-------------------------------------------------------------------

Old:
----
  yast2-4.2.81.tar.bz2

New:
----
  yast2-4.2.82.tar.bz2

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

Other differences:
------------------
++++++ yast2.spec ++++++
--- /var/tmp/diff_new_pack.4YfBcg/_old  2020-04-17 13:36:36.280177510 +0200
+++ /var/tmp/diff_new_pack.4YfBcg/_new  2020-04-17 13:36:36.284177513 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           yast2
-Version:        4.2.81
+Version:        4.2.82
 Release:        0
 Summary:        YaST2 Main Package
 License:        GPL-2.0-only

++++++ yast2-4.2.81.tar.bz2 -> yast2-4.2.82.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-4.2.81/library/network/src/modules/NetworkInterfaces.rb 
new/yast2-4.2.82/library/network/src/modules/NetworkInterfaces.rb
--- old/yast2-4.2.81/library/network/src/modules/NetworkInterfaces.rb   
2020-04-07 14:46:40.000000000 +0200
+++ new/yast2-4.2.82/library/network/src/modules/NetworkInterfaces.rb   
2020-04-13 18:11:42.000000000 +0200
@@ -801,12 +801,11 @@
 
       # remove deleted devices
       log.info("Deleted=#{@Deleted}")
-      Builtins.foreach(@Deleted) do |d|
-        # delete config file
-        p = Builtins.add(path(".network.section"), d)
-        log.debug("deleting: #{p}")
-        SCR.Write(p, nil)
+      @Deleted.each do |d|
+        iface, alias_num = d.split("#")
+        alias_num ? delete_alias(original_devs, iface, alias_num) : 
delete_device(iface)
       end
+
       @Deleted = []
 
       # write all devices
@@ -1537,6 +1536,38 @@
       devices
     end
 
+    # Convenience method to delete an interface config file from the system
+    #
+    # @param iface [String] interface name of the config file to be deleted
+    def delete_device(iface)
+      p = path(".network.section") + iface
+      log.debug("deleting: #{p}")
+      SCR.Write(p, nil)
+    end
+
+    # Convenience method to delete an specific ip alias from an interface
+    # config file
+    #
+    # @param devices [Hash<String, Hash<String, Object>>] hash with the devices
+    #   to remove the aliases from
+    # @param iface [String] interface name of the alias which alias need to be
+    #   removed
+    # @param alias_num [String] index num of the alias that needs to be removed
+    def delete_alias(devices, iface, alias_num)
+      dev_map = devices.values.find { |d| d.keys.include?(iface) } || {}
+      dev_aliases = dev_map.fetch(iface, {}).fetch("_aliases", {})
+
+      base = path(".network.value") + iface
+      # look in OriginalDevs because we need to catch all variables
+      # of the alias
+
+      dev_aliases.fetch(alias_num, {}).keys.each do |key|
+        p = base + "#{key}_#{alias_num}"
+        log.debug("deleting: #{p}")
+        SCR.Write(p, nil)
+      end
+    end
+
     publish variable: :Name, type: "string"
     publish variable: :Current, type: "map <string, any>"
     publish variable: :CardRegex, type: "map <string, string>"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-4.2.81/library/network/test/network_interfaces_test.rb 
new/yast2-4.2.82/library/network/test/network_interfaces_test.rb
--- old/yast2-4.2.81/library/network/test/network_interfaces_test.rb    
2020-04-07 14:46:40.000000000 +0200
+++ new/yast2-4.2.82/library/network/test/network_interfaces_test.rb    
2020-04-13 18:11:42.000000000 +0200
@@ -322,6 +322,8 @@
     let(:network_path) { File.join(data_dir, "etc/sysconfig/network") }
     let(:ifcfg_copy) { File.join(network_path, "ifcfg-copy") }
     let(:ifcfg_file) { File.join(network_path, "ifcfg-eth1") }
+    let(:eth0_back) { File.join(network_path, "ifcfg-eth0.backup") }
+    let(:eth0) { File.join(network_path, "ifcfg-eth0") }
 
     before do
       subject.CleanCacheRead()
@@ -329,8 +331,11 @@
 
     around do |example|
       ::FileUtils.cp(ifcfg_file, ifcfg_copy)
+      ::FileUtils.cp(eth0, eth0_back)
       change_scr_root(data_dir, &example)
+      ::FileUtils.cp(eth0_back, eth0)
       ::FileUtils.rm(ifcfg_copy)
+      ::FileUtils.rm(eth0_back)
     end
 
     context "when the configuration has changed" do
@@ -364,6 +369,18 @@
         subject.Write("")
         expect(subject.List("").size).to eq(size - 1)
       end
+
+      it "deletes removed aliases" do
+        devmap = subject.devmap("eth0")
+        expect(devmap["_aliases"].size).to eq(1)
+        subject.Edit("eth0")
+        subject.Current["_aliases"] = {}
+        subject.Commit()
+        subject.DeleteAlias("eth0", "0")
+        subject.Write("")
+        devmap = subject.devmap("eth0")
+        expect(devmap["_aliases"]).to be(nil)
+      end
     end
   end
 end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-4.2.81/package/yast2.changes 
new/yast2-4.2.82/package/yast2.changes
--- old/yast2-4.2.81/package/yast2.changes      2020-04-07 14:46:40.000000000 
+0200
+++ new/yast2-4.2.82/package/yast2.changes      2020-04-13 18:11:42.000000000 
+0200
@@ -1,4 +1,11 @@
 -------------------------------------------------------------------
+Mon Apr 13 12:36:58 UTC 2020 - Knut Anderssen <kanders...@suse.com>
+
+- Remove ip aliases that were marked to be deleted from the
+  interface configuration files (bsc#1146020)
+- 4.2.82
+
+-------------------------------------------------------------------
 Tue Apr  7 08:33:55 UTC 2020 - Stefan Hundhammer <shundham...@suse.com>
 
 - Retranslate wizard help button in NCurses UI (bsc#1167224)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-4.2.81/package/yast2.spec 
new/yast2-4.2.82/package/yast2.spec
--- old/yast2-4.2.81/package/yast2.spec 2020-04-07 14:46:40.000000000 +0200
+++ new/yast2-4.2.82/package/yast2.spec 2020-04-13 18:11:42.000000000 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           yast2
-Version:        4.2.81
+Version:        4.2.82
 Release:        0
 Summary:        YaST2 Main Package
 License:        GPL-2.0-only


Reply via email to