Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Thomas <nick@gitlab.com>2018-10-24 18:03:00 +0300
committerNick Thomas <nick@gitlab.com>2018-10-25 15:51:45 +0300
commit324ff19571cada7e148c53bb70e70f823eff4335 (patch)
treea9f906cda57278e97c2f78c4a734f750091e19f7 /app/controllers
parenta1ee2072f1a7c197e13bd2d5f8ca59ad1deb1c49 (diff)
Backport SSH host key detection code to CE
This functionality is needed for SSH push mirroring support, which is a CE feature.
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/projects/mirrors_controller.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/app/controllers/projects/mirrors_controller.rb b/app/controllers/projects/mirrors_controller.rb
index 78d5faf2326..53176978416 100644
--- a/app/controllers/projects/mirrors_controller.rb
+++ b/app/controllers/projects/mirrors_controller.rb
@@ -44,6 +44,22 @@ class Projects::MirrorsController < Projects::ApplicationController
redirect_to_repository_settings(project, anchor: 'js-push-remote-settings')
end
+ def ssh_host_keys
+ lookup = SshHostKey.new(project: project, url: params[:ssh_url], compare_host_keys: params[:compare_host_keys])
+
+ if lookup.error.present?
+ # Failed to read keys
+ render json: { message: lookup.error }, status: :bad_request
+ elsif lookup.known_hosts.nil?
+ # Still working, come back later
+ render body: nil, status: :no_content
+ else
+ render json: lookup
+ end
+ rescue ArgumentError => err
+ render json: { message: err.message }, status: :bad_request
+ end
+
private
def remote_mirror