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

parent 7a048641
...@@ -93,7 +93,7 @@ module Geo ...@@ -93,7 +93,7 @@ module Geo
end end
def primary_ssh_path_prefix def primary_ssh_path_prefix
Gitlab::Geo.primary_ssh_path_prefix Gitlab::Geo.primary_node.clone_url_prefix
end end
def ssh_url_to_repo def ssh_url_to_repo
......
...@@ -58,10 +58,6 @@ module Gitlab ...@@ -58,10 +58,6 @@ module Gitlab
self.cache_value(:geo_node_secondary) { self.enabled? && self.current_node && self.current_node.secondary? } self.cache_value(:geo_node_secondary) { self.enabled? && self.current_node && self.current_node.secondary? }
end 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:) def self.geo_node?(host:, port:)
GeoNode.where(host: host, port: port).exists? GeoNode.where(host: host, port: port).exists?
end end
...@@ -145,19 +141,5 @@ module Gitlab ...@@ -145,19 +141,5 @@ module Gitlab
# urlsafe_base64 may return a string of size * 4/3 # urlsafe_base64 may return a string of size * 4/3
SecureRandom.urlsafe_base64(size)[0, size] SecureRandom.urlsafe_base64(size)[0, size]
end 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
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