Skip to content

Commit

Permalink
import the certificate just once in AutoYast installation
Browse files Browse the repository at this point in the history
to avoid possible infinite loop
  • Loading branch information
lslezak committed Aug 7, 2014
1 parent 1f78d77 commit fceef2e
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/lib/registration/connect_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ class ConnectHelpers
# @param show_update_hint [Boolean] true if an extra hint for registration update
# should be displayed
def self.catch_registration_errors(message_prefix: "", show_update_hint: false, &block)
# import the SSL certificate just once to avoid an infinite loop
certificate_imported = false
begin
# reset the previous SSL errors
Storage::SSLErrors.instance.reset
Expand Down Expand Up @@ -146,8 +148,13 @@ def self.catch_registration_errors(message_prefix: "", show_update_hint: false,
if cert.fingerprint_match?(expected_cert_type,
Storage::Config.instance.reg_server_cert_fingerprint)

# import the certificate and retry
retry if import_ssl_certificate(cert)
# import the certificate and retry (just once)
if !certificate_imported
import_ssl_certificate(cert)
certificate_imported = true
retry
end

report_ssl_error(e.message)
else
# error message
Expand Down

0 comments on commit fceef2e

Please sign in to comment.