diff --git a/package/yast2-packager.changes b/package/yast2-packager.changes index 06e748cf9..67cb48c08 100644 --- a/package/yast2-packager.changes +++ b/package/yast2-packager.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Mon Sep 21 08:30:04 UTC 2020 - Ladislav Slezák + +- Fixed WFM.Args call to not produce an error message in the y2log + (bsc#1176653) +- 4.3.8 + ------------------------------------------------------------------- Wed Sep 16 12:17:07 UTC 2020 - Ladislav Slezák diff --git a/package/yast2-packager.spec b/package/yast2-packager.spec index f187dad43..4687291fe 100644 --- a/package/yast2-packager.spec +++ b/package/yast2-packager.spec @@ -17,7 +17,7 @@ Name: yast2-packager -Version: 4.3.7 +Version: 4.3.8 Release: 0 Summary: YaST2 - Package Library License: GPL-2.0-or-later diff --git a/src/lib/y2packager/medium_type.rb b/src/lib/y2packager/medium_type.rb index a869b0ab1..e00cdc176 100644 --- a/src/lib/y2packager/medium_type.rb +++ b/src/lib/y2packager/medium_type.rb @@ -80,6 +80,8 @@ def standard? # @return [Boolean] True if the client should be skipped. # def skip_step? + return false if Yast::WFM.Args.empty? + skip = Yast::WFM.Args(0) && Yast::WFM.Args(0)["skip"] return true if skip&.split(",")&.include?(type.to_s) diff --git a/test/medium_type_test.rb b/test/medium_type_test.rb index 13e52227a..a5a406bc7 100644 --- a/test/medium_type_test.rb +++ b/test/medium_type_test.rb @@ -92,6 +92,11 @@ end end + def mock_arguments(arg) + allow(Yast::WFM).to receive(:Args).and_return([arg]) + allow(Yast::WFM).to receive(:Args).with(0).and_return(arg) + end + describe "#skip_step?" do context "online installation medium" do before do @@ -99,27 +104,31 @@ end it "returns true if the client args contain \"skip\" => \"online\"" do - allow(Yast::WFM).to receive(:Args).with(0).and_return("skip" => "online") + mock_arguments("skip" => "online") expect(Y2Packager::MediumType.skip_step?).to eq(true) end it "returns true if the client args contain \"skip\" => \"standard,online\"" do - allow(Yast::WFM).to receive(:Args).with(0).and_return("skip" => "standard,online") + mock_arguments("skip" => "standard,online") expect(Y2Packager::MediumType.skip_step?).to eq(true) end it "returns false if the client args do not contain \"skip\" => \"online\"" do - allow(Yast::WFM).to receive(:Args).with(0).and_return({}) + mock_arguments({}) expect(Y2Packager::MediumType.skip_step?).to eq(false) end it "returns false if the client args contain \"only\" => \"online\"" do - allow(Yast::WFM).to receive(:Args).with(0).and_return("only" => "online") + mock_arguments("only" => "online") expect(Y2Packager::MediumType.skip_step?).to eq(false) end it "returns false if the client args contain \"only\" => \"online,standard\"" do - allow(Yast::WFM).to receive(:Args).with(0).and_return("only" => "standard,online") + mock_arguments("only" => "standard,online") expect(Y2Packager::MediumType.skip_step?).to eq(false) end it "returns false if the client args do not contain \"only\" => \"online\"" do - allow(Yast::WFM).to receive(:Args).with(0).and_return({}) + mock_arguments({}) + expect(Y2Packager::MediumType.skip_step?).to eq(false) + end + it "returns false if the client args are empty" do + allow(Yast::WFM).to receive(:Args).and_return([]) expect(Y2Packager::MediumType.skip_step?).to eq(false) end end