Skip to content

Commit

Permalink
Merge pull request #377 from yast/installed_products
Browse files Browse the repository at this point in the history
Fixed reading installed products (bsc#1095702)
  • Loading branch information
lslezak authored Jun 6, 2018
2 parents 5be5eb7 + 0dd25ba commit c565b07
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
7 changes: 7 additions & 0 deletions package/yast2-registration.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
-------------------------------------------------------------------
Wed Jun 6 07:33:07 UTC 2018 - lslezak@suse.cz

- Fixed also the another places detecting the installed product
(bsc#1095702)
- 4.0.39

-------------------------------------------------------------------
Tue Jun 5 10:12:07 UTC 2018 - lslezak@suse.cz

Expand Down
2 changes: 1 addition & 1 deletion 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.38
Version: 4.0.39
Release: 0

BuildRoot: %{_tmppath}/%{name}-%{version}-build
Expand Down
12 changes: 8 additions & 4 deletions src/lib/registration/sw_mgmt.rb
Original file line number Diff line number Diff line change
Expand Up @@ -200,16 +200,17 @@ def self.evaluate_product(p, selected, installed)
elsif Stage.initial
# during upgrade it depends on whether target is already initialized,
# use the product from the medium for the self-update step
# (during upgrade the installed product might me already selected for removal)
if installed
p["status"] == :installed && p["type"] == "base"
(p["status"] == :installed || p["status"] == :removed) && p["type"] == "base"
elsif selected
p["status"] == :selected
else
p["status"] == :available
end
else
# in installed system or at upgrade the base product has valid type
p["status"] == :installed && p["type"] == "base"
(p["status"] == :installed || p["status"] == :removed) && p["type"] == "base"
end
end

Expand All @@ -224,7 +225,9 @@ def self.product_selected?
# Any product installed? (e.g. during upgrade)
# @return [Boolean] true if at least one product is installed
def self.product_installed?
Pkg.ResolvableProperties("", :product, "").any? { |p| p["status"] == :installed }
Pkg.ResolvableProperties("", :product, "").any? do |p|
p["status"] == :installed || p["status"] == :removed
end
end

def self.installed_products
Expand Down Expand Up @@ -484,7 +487,8 @@ def self.find_addon_updates(addons)
products = Pkg.ResolvableProperties("", :product, "")

installed_addons = products.select do |product|
product["status"] == :installed && product["type"] != "base"
(product["status"] == :installed || product["status"] == :removed) &&
product["type"] != "base"
end

product_names = installed_addons.map { |a| "#{a["name"]}-#{a["version"]}-#{a["release"]}" }
Expand Down

0 comments on commit c565b07

Please sign in to comment.