Hello community, here is the log from the commit of package yast2-network for openSUSE:Factory checked in at 2017-03-10 20:38:48 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/yast2-network (Old) and /work/SRC/openSUSE:Factory/.yast2-network.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "yast2-network" Fri Mar 10 20:38:48 2017 rev:369 rq:469519 version:3.2.20 Changes: -------- --- /work/SRC/openSUSE:Factory/yast2-network/yast2-network.changes 2017-02-04 16:52:31.453298541 +0100 +++ /work/SRC/openSUSE:Factory/.yast2-network.new/yast2-network.changes 2017-03-10 20:38:48.880285239 +0100 @@ -1,0 +2,8 @@ +Wed Feb 22 10:49:17 UTC 2017 - mfilka@suse.com + +- bnc#1020074 + - when incomplete udev rule is read from the AY profile, it is + ignored instead of raising an internal error. +- 3.2.20 + +------------------------------------------------------------------- Old: ---- yast2-network-3.2.19.tar.bz2 New: ---- yast2-network-3.2.20.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ yast2-network.spec ++++++ --- /var/tmp/diff_new_pack.T69ntf/_old 2017-03-10 20:38:49.564188327 +0100 +++ /var/tmp/diff_new_pack.T69ntf/_new 2017-03-10 20:38:49.564188327 +0100 @@ -17,7 +17,7 @@ Name: yast2-network -Version: 3.2.19 +Version: 3.2.20 Release: 0 BuildArch: noarch ++++++ yast2-network-3.2.19.tar.bz2 -> yast2-network-3.2.20.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-3.2.19/package/yast2-network.changes new/yast2-network-3.2.20/package/yast2-network.changes --- old/yast2-network-3.2.19/package/yast2-network.changes 2017-01-31 09:53:13.843173433 +0100 +++ new/yast2-network-3.2.20/package/yast2-network.changes 2017-03-03 12:00:02.764000000 +0100 @@ -1,4 +1,12 @@ ------------------------------------------------------------------- +Wed Feb 22 10:49:17 UTC 2017 - mfilka@suse.com + +- bnc#1020074 + - when incomplete udev rule is read from the AY profile, it is + ignored instead of raising an internal error. +- 3.2.20 + +------------------------------------------------------------------- Thu Jan 19 15:22:03 UTC 2017 - kanderssen@suse.com - Added network proposal using the new summary api and the new diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-3.2.19/package/yast2-network.spec new/yast2-network-3.2.20/package/yast2-network.spec --- old/yast2-network-3.2.19/package/yast2-network.spec 2017-01-31 09:53:13.843173433 +0100 +++ new/yast2-network-3.2.20/package/yast2-network.spec 2017-03-03 12:00:02.768000000 +0100 @@ -17,7 +17,7 @@ Name: yast2-network -Version: 3.2.19 +Version: 3.2.20 Release: 0 BuildArch: noarch diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-3.2.19/src/lib/network/network_autoyast.rb new/yast2-network-3.2.20/src/lib/network/network_autoyast.rb --- old/yast2-network-3.2.19/src/lib/network/network_autoyast.rb 2017-01-31 09:53:14.075173433 +0100 +++ new/yast2-network-3.2.20/src/lib/network/network_autoyast.rb 2017-03-03 12:00:03.040000000 +0100 @@ -218,6 +218,15 @@ ay_profile["networking"] end + # Checks if the udev rule is valid for renaming a NIC + def valid_rename_udev_rule?(rule) + return false if rule["name"].nil? || rule["name"].empty? + return false if rule["rule"].nil? || rule["rule"].empty? + return false if rule["value"].nil? || rule["value"].empty? + + true + end + # Takes a list of udev rules and assignes them to corresponding devices. # # If a device has an udev rule defined already, it is overwritten by new one. @@ -228,7 +237,11 @@ udev_rules.each do |rule| name_to = rule["name"] attr = rule["rule"] - key = rule["value"].downcase + key = rule["value"] + + next if !valid_rename_udev_rule?(rule) + key.downcase! + item, matching_item = LanItems.Items.find do |_, i| i["hwinfo"]["busid"].downcase == key || i["hwinfo"]["mac"].downcase == key end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-3.2.19/test/network_autoyast_test.rb new/yast2-network-3.2.20/test/network_autoyast_test.rb --- old/yast2-network-3.2.19/test/network_autoyast_test.rb 2017-01-31 09:53:14.227173433 +0100 +++ new/yast2-network-3.2.20/test/network_autoyast_test.rb 2017-03-03 12:00:03.168000000 +0100 @@ -319,4 +319,33 @@ end end end + + describe "#valid_rename_udev_rule?" do + it "fails when the rule do not contain new name" do + rule = { "rule" => "ATTR{address}", "value" => "00:02:29:69:d3:63" } + expect(network_autoyast.send(:valid_rename_udev_rule?, rule)).to be false + expect(network_autoyast.send(:valid_rename_udev_rule?, rule["name"] = "")).to be false + end + + it "fails when the rule do not contain dev attribute" do + rule = { "name" => "eth0", "value" => "00:02:29:69:d3:63" } + expect(network_autoyast.send(:valid_rename_udev_rule?, rule)).to be false + expect(network_autoyast.send(:valid_rename_udev_rule?, rule["rule"] = "")).to be false + end + + it "fails when the rule do not contain dev attribute's value" do + rule = { "name" => "eth0", "rule" => "ATTR{address}" } + expect(network_autoyast.send(:valid_rename_udev_rule?, rule)).to be false + expect(network_autoyast.send(:valid_rename_udev_rule?, rule["value"] = "")).to be false + end + + it "succeedes for complete rule" do + complete_rule = { + "name" => "eth0", + "rule" => "ATTR{address}", + "value" => "00:02:29:69:d3:63" + } + expect(network_autoyast.send(:valid_rename_udev_rule?, complete_rule)).to be true + end + end end