Commit cba2826e authored by Robert Speicher's avatar Robert Speicher

Merge branch 'da-fix-clone-url-for-geo-repo-sync' into 'master'

Geo: use GeoNode#clone_url_prefix for the Geo::RepositorySyncService

See merge request !2028
parents 27a8cc7b 3711008c
......@@ -93,7 +93,7 @@ module Geo
end
def primary_ssh_path_prefix
Gitlab::Geo.primary_ssh_path_prefix
Gitlab::Geo.primary_node.clone_url_prefix
end
def ssh_url_to_repo
......
---
title: Geo - Use GeoNode#clone_url_prefix for the Geo::RepositorySyncService
merge_request:
author:
......@@ -58,10 +58,6 @@ module Gitlab
self.cache_value(:geo_node_secondary) { self.enabled? && self.current_node && self.current_node.secondary? }
end
def self.primary_ssh_path_prefix
self.cache_value(:geo_primary_ssh_path_prefix) { self.enabled? && self.primary_node && build_primary_ssh_path_prefix }
end
def self.geo_node?(host:, port:)
GeoNode.where(host: host, port: port).exists?
end
......@@ -145,19 +141,5 @@ module Gitlab
# urlsafe_base64 may return a string of size * 4/3
SecureRandom.urlsafe_base64(size)[0, size]
end
def self.build_primary_ssh_path_prefix
primary_host = "#{Gitlab.config.gitlab_shell.ssh_user}@#{self.primary_node.host}"
if Gitlab.config.gitlab_shell.ssh_port != 22
"ssh://#{primary_host}:#{Gitlab.config.gitlab_shell.ssh_port}/"
else
if self.primary_node.host.include? ':'
"[#{primary_host}]:"
else
"#{primary_host}:"
end
end
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment