Skip to content

Commit

Permalink
Handle missing product
Browse files Browse the repository at this point in the history
  • Loading branch information
lslezak committed Jan 17, 2018
1 parent b5aa7ba commit a5ec3f4
Showing 1 changed file with 19 additions and 6 deletions.
25 changes: 19 additions & 6 deletions src/lib/y2packager/clients/inst_product_upgrade_license.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,27 @@ module Y2Packager
module Clients
# This client shows a license confirmation dialog for the upgraded base product
#
# The client will be skipped (returning `:auto`) in these situations:
#
# * There is no license available for the selected base product.
# * There is only 1 base product (not a multi-product media at all). In
# that case, the license is supposed to has been already accepted in the
# welcome screen.
# The client will display an error and return :back if not product is found.
# If no license is found for the selected product it returns :auto.
# @see Y2Packager::Clients::InstProductLicense
class InstProductUpgradeLicense < InstProductLicense

def main
textdomain "installation"

if !product
# TRANSLATORS: An error message, the package solver could not find
# any product to upgrade in the selected partition.
Report.Error(_("Error: Cannot find any product to upgrade.\n" \
"Make sure the selected partition contains an upgradable product."))
return :back
end

return :auto unless available_license?

Y2Packager::Dialogs::InstProductLicense.new(product).run
end

private

# Return the selected base product for upgrade
Expand Down

0 comments on commit a5ec3f4

Please sign in to comment.