From d7633157f36bf7eeabe549a12d14258d2d3b755a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ladislav=20Slez=C3=A1k?= Date: Thu, 30 Aug 2018 16:50:25 +0200 Subject: [PATCH 1/2] Better check the not installed products (bsc#1103412) - Some specific repositories do not provide any product - Fixes online migration on PPC - 3.2.16 --- package/yast2-registration.changes | 8 ++++++++ package/yast2-registration.spec | 2 +- src/lib/registration/addon.rb | 9 ++++++++- test/addon_spec.rb | 18 ++++++++++++++++++ 4 files changed, 35 insertions(+), 2 deletions(-) diff --git a/package/yast2-registration.changes b/package/yast2-registration.changes index eee02bd5d..838f1beba 100644 --- a/package/yast2-registration.changes +++ b/package/yast2-registration.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Fri Aug 31 10:12:16 UTC 2018 - lslezak@suse.cz + +- Better check the not installed addon products, some specific + repositories do not provide any product +- Fixes online migration on PPC (bsc#1103412) +- 3.2.16 + ------------------------------------------------------------------- Thu Jul 26 09:25:16 UTC 2018 - lslezak@suse.cz diff --git a/package/yast2-registration.spec b/package/yast2-registration.spec index b8f112249..40f33d4e6 100644 --- a/package/yast2-registration.spec +++ b/package/yast2-registration.spec @@ -17,7 +17,7 @@ Name: yast2-registration -Version: 3.2.15 +Version: 3.2.16 Release: 0 BuildRoot: %{_tmppath}/%{name}-%{version}-build diff --git a/src/lib/registration/addon.rb b/src/lib/registration/addon.rb index 710c99c43..db0019758 100644 --- a/src/lib/registration/addon.rb +++ b/src/lib/registration/addon.rb @@ -65,14 +65,21 @@ def selected end # return add-ons which are registered but not installed in the system + # and are available to install # @return [Array] the list of add-ons def registered_not_installed registered.select do |addon| - !SwMgmt.installed_products.find do |product| + installed = SwMgmt.installed_products.find do |product| product["name"] == addon.identifier && product["version_version"] == addon.version && product["arch"] == addon.arch end + + available = Yast::Pkg.ResolvableProperties(addon.identifier, :product, "").find do |p| + p["status"] == :available + end + + !installed && available end end diff --git a/test/addon_spec.rb b/test/addon_spec.rb index 5139af01c..bda976594 100644 --- a/test/addon_spec.rb +++ b/test/addon_spec.rb @@ -105,11 +105,29 @@ addon2 = addons.find { |addon| addon.name == "prod2" } expect(Registration::SwMgmt).to receive(:installed_products).and_return([]) + expect(Yast::Pkg).to receive(:ResolvableProperties).with(prod2.identifier, :product, "") + .and_return(["status" => :available]) reg_not_installed_addons = Registration::Addon.registered_not_installed expect(reg_not_installed_addons.size).to eql(1) expect(reg_not_installed_addons.first.name).to eql(addon2.name) end + + it "does not return not addons with not available products" do + prod = addon_generator("name" => "prod") + registration = double( + activated_products: [prod], + get_addon_list: [prod] + ) + + Registration::Addon.find_all(registration) + + expect(Registration::SwMgmt).to receive(:installed_products).and_return([]) + expect(Yast::Pkg).to receive(:ResolvableProperties).with(prod.identifier, :product, "") + .and_return([]) + + expect(Registration::Addon.registered_not_installed).to be_empty + end end describe "#unregistered" do From 4568fd65a5d63d040070feba8422bb7e4f63fe49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ladislav=20Slez=C3=A1k?= Date: Fri, 31 Aug 2018 13:16:39 +0200 Subject: [PATCH 2/2] Fixed test description --- test/addon_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/addon_spec.rb b/test/addon_spec.rb index bda976594..0662678bc 100644 --- a/test/addon_spec.rb +++ b/test/addon_spec.rb @@ -113,7 +113,7 @@ expect(reg_not_installed_addons.first.name).to eql(addon2.name) end - it "does not return not addons with not available products" do + it "does not return addons without available products" do prod = addon_generator("name" => "prod") registration = double( activated_products: [prod],