Skip to content

Commit

Permalink
[webui] do not crash when handling remote instance with invalid SSL CA
Browse files Browse the repository at this point in the history
This happened when adding packman OBS instance and trying to add
a repository in the simple webui view.

Repository targets won't become visible anyway.
  • Loading branch information
adrianschroeter committed Jun 18, 2014
1 parent 24af2e5 commit de301a2
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/api/app/models/distribution.rb
Expand Up @@ -49,7 +49,13 @@ def self.all_including_remotes
remote_projects = Project.where("NOT ISNULL(projects.remoteurl)")
remote_projects.each do |prj|
body = Rails.cache.fetch("remote_distribution_#{prj.id}", expires_in: 1.hour) do
ActiveXML.backend.load_external_url(prj.remoteurl + "/distributions.xml")
begin
ActiveXML.backend.load_external_url(prj.remoteurl + "/distributions.xml")
rescue OpenSSL::SSL::SSLError
# skip, but do not die if remote instance have invalid SSL
Rails.logger.error "Remote instance #{prj.remoteurl} has no valid SSL certificate"
next
end
end
next if body.blank? # don't let broken remote instances break us
xmlhash = Xmlhash.parse(body)
Expand Down

0 comments on commit de301a2

Please sign in to comment.