Skip to content

Commit

Permalink
fixed crash (nil error) when reading available extensions
Browse files Browse the repository at this point in the history
- 3.1.76
  • Loading branch information
lslezak committed Jun 16, 2014
1 parent e887929 commit 27cf54c
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 10 deletions.
6 changes: 6 additions & 0 deletions package/yast2-registration.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
-------------------------------------------------------------------
Mon Jun 16 16:05:20 UTC 2014 - lslezak@suse.cz

- fixed crash (nil error) when reading available extensions
- 3.1.76

-------------------------------------------------------------------
Fri Jun 13 15:32:20 UTC 2014 - 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: 3.1.75
Version: 3.1.76
Release: 0

BuildRoot: %{_tmppath}/%{name}-%{version}-build
Expand Down
12 changes: 9 additions & 3 deletions src/lib/registration/registration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,18 @@ def register(email, reg_code, distro_target)
def register_product(product, email = nil)
service_for_product(product) do |product_ident, params|
log.info "Registering product: #{product}"
SUSE::Connect::YaST.activate_product(product_ident, params, email)
service = SUSE::Connect::YaST.activate_product(product_ident, params, email)
log.info "Register product result: #{service}"
service
end
end

def upgrade_product(product)
service_for_product(product) do |product_ident, params|
log.info "Upgrading product: #{product}"
SUSE::Connect::YaST.upgrade_product(product_ident, params)
service = SUSE::Connect::YaST.upgrade_product(product_ident, params)
log.info "Upgrade product result: #{service}"
service
end
end

Expand All @@ -85,7 +89,9 @@ def get_addon_list
)

params = connect_params({})
addons = SUSE::Connect::YaST.show_product(remote_product, params)
addons = SUSE::Connect::YaST.show_product(remote_product, params).extensions || []
log.info "Available addons result: #{addons}"

# ignore the base product "addon"
addons.reject{ |a| a.identifier == base_product["name"] }
end
Expand Down
11 changes: 5 additions & 6 deletions src/lib/registration/ui/addon_eula_dialog.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,11 @@ def run
# @param addon [SUSE::Connect::Product] the addon
# @return [Boolean] true if the EULA has been accepted
def accept_eula(addon)
addon_name = product.label
Dir.mktmpdir("extension-eula-") do |tmpdir|
begin
Yast::Popup.Feedback(
_("Downloading License Agreement..."),
addon_name
addon.label
) do
# download the license (with translations)
loader = EulaDownloader.new(addon.eula_url, tmpdir,
Expand All @@ -84,25 +83,25 @@ def accept_eula(addon)
rescue Exception => e
log.error "Download failed: #{e.message}: #{e.backtrace}"
# %s is an extension name, e.g. "SUSE Linux Enterprise Software Development Kit"
Yast::Report.Error(_("Downloading the license for\n%s\nfailed.") % addon_name)
Yast::Report.Error(_("Downloading the license for\n%s\nfailed.") % addon.label)
#FIXME change for GA!!!
return true
end

id = "#{addon_name} extension EULA"
id = "#{addon.label} extension EULA"
Yast::ProductLicense.SetAcceptanceNeeded(id, true)
Yast::ProductLicense.license_file_print = addon.eula_url

# %s is an extension name, e.g. "SUSE Linux Enterprise Software Development Kit"
title = _("%s License Agreement") % addon_name
title = _("%s License Agreement") % addon.label
eulas = read_downloaded_eulas(tmpdir)
enable_back = true

Yast::ProductLicense.DisplayLicenseDialogWithTitle(eulas.keys, enable_back,
eula_lang(eulas.keys), arg_ref(eulas), id, title)

# TODO FIXME: this a workaround, remove before RC/GM!!
display_beta_warning(addon_name)
display_beta_warning(addon.label)

base_product = false
action = "abort"
Expand Down

0 comments on commit 27cf54c

Please sign in to comment.