Skip to content

Commit

Permalink
Raise a Registration::InvalidURL exception, and report it.
Browse files Browse the repository at this point in the history
  • Loading branch information
teclator committed May 10, 2017
1 parent 7105fb1 commit 907fb3d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 22 deletions.
5 changes: 5 additions & 0 deletions src/lib/installation/clients/inst_update_installer.rb
Expand Up @@ -176,6 +176,10 @@ def update_repositories
@update_repositories = update_repositories_finder.updates
log.info("self-update repositories are #{@update_repositories.inspect}")
@update_repositories
rescue ::Registration::InvalidURL
Yast::Popup.Error(_("The registration URL provided is not valid.\n" \
"Skipping installer update.\n"))
@update_repositories = []
end

# Return the custom self-update URL
Expand Down Expand Up @@ -311,6 +315,7 @@ def require_registration_libraries
require "registration/url_helpers"
require "registration/registration"
require "registration/ui/regservice_selection_dialog"
require "registration/exceptions"
@require_registration_libraries = true
rescue LoadError
log.info "yast2-registration is not available"
Expand Down
24 changes: 2 additions & 22 deletions src/lib/installation/update_repositories_finder.rb
Expand Up @@ -25,7 +25,6 @@
Yast.import "Mode"
Yast.import "Profile"
Yast.import "ProductFeatures"
Yast.import "Report"

module Installation
# This class find repositories to be used by the self-update feature.
Expand Down Expand Up @@ -126,9 +125,8 @@ def update_url_from_control
def update_urls_from_connect
begin
url = registration_url
rescue URI::InvalidURIError => e
log.error("Custom registration url is wrong, URI failed with: #{e.message}")
return []
rescue URI::InvalidURIError
raise ::Registration::InvalidURL
end

return [] if url == :cancel
Expand Down Expand Up @@ -262,24 +260,6 @@ def import_registration_ayconfig
)
end

# Display a warning message about using the default update URL from
# control.xml when the registration server does not return any URL or fails.
# In AutoYaST mode the dialog is closed after a timeout.
def display_fallback_warning
# TRANSLATORS: error message
msg = _("<p>Cannot obtain the installer update repository URL\n" \
"from the registration server.</p>")

if update_url_from_control
# TRANSLATORS: part of an error message, %s is the default repository
# URL from control.xml
msg += _("<p>The default URL %s will be used.<p>") % update_url_from_control
end

# display the message in a RichText widget to wrap long lines
Yast::Report.LongWarning(msg)
end

# Runs a block of code handling errors
#
# If errors should be shown, the helper {catch_registration_errors}
Expand Down

0 comments on commit 907fb3d

Please sign in to comment.