Skip to content

Commit

Permalink
Merge pull request #396 from yast/sle12_merge
Browse files Browse the repository at this point in the history
  • Loading branch information
lslezak committed Aug 31, 2018
2 parents bb0eff3 + b08f6cb commit 3beb5c9
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 3 deletions.
8 changes: 8 additions & 0 deletions package/yast2-registration.changes
Original file line number Diff line number Diff line change
@@ -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)
- 4.0.44

-------------------------------------------------------------------
Wed Jul 18 10:45:15 CEST 2018 - schubi@suse.de

Expand Down
4 changes: 2 additions & 2 deletions package/yast2-registration.spec
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@


Name: yast2-registration
Version: 4.0.43
Version: 4.0.44
Release: 0

BuildRoot: %{_tmppath}/%{name}-%{version}-build
Expand Down Expand Up @@ -54,7 +54,7 @@ BuildRequires: update-desktop-files
BuildRequires: yast2-devtools >= 3.1.39
BuildRequires: rubygem(yast-rake) >= 0.2.5
BuildRequires: rubygem(rspec)
BuildRequires: rubygem(suse-connect) >= 0.2.22
BuildRequires: rubygem(suse-connect) >= 0.3.11
BuildRequires: yast2-slp >= 3.1.9
# updated product renames
BuildRequires: yast2-packager >= 4.0.40
Expand Down
9 changes: 8 additions & 1 deletion src/lib/registration/addon.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,21 @@ def auto_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
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,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 3beb5c9

Please sign in to comment.