Skip to content

Commit

Permalink
Merge a05301c into 77944b7
Browse files Browse the repository at this point in the history
  • Loading branch information
lslezak committed Aug 31, 2018
2 parents 77944b7 + a05301c commit c53ebdb
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 2 deletions.
8 changes: 8 additions & 0 deletions 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

Expand Down
2 changes: 1 addition & 1 deletion package/yast2-registration.spec
Expand Up @@ -17,7 +17,7 @@


Name: yast2-registration
Version: 3.2.15
Version: 3.2.16
Release: 0

BuildRoot: %{_tmppath}/%{name}-%{version}-build
Expand Down
9 changes: 8 additions & 1 deletion src/lib/registration/addon.rb
Expand Up @@ -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<Addon>] 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

Expand Down
18 changes: 18 additions & 0 deletions test/addon_spec.rb
Expand Up @@ -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 addons without 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
Expand Down

0 comments on commit c53ebdb

Please sign in to comment.