Use single string-based proxy declaration

This commit is contained in:
David Heinemeier Hansson
2023-01-31 13:59:19 +01:00
committed by Chris de Bruin
parent 1fef6ba505
commit 71681cb8be
3 changed files with 24 additions and 24 deletions

View File

@@ -112,26 +112,15 @@ class Mrsk::Configuration
end
end
def ssh_proxy
if raw_config.ssh.present? && raw_config.ssh["proxy"]
Net::SSH::Proxy::Jump.new \
raw_config.ssh["proxy"].include?("@") ? raw_config.ssh["proxy"] : "root@#{raw_config.ssh["proxy"]}"
end
end
def ssh_options
options = { user: ssh_user, auth_methods: [ "publickey" ] }
options[:proxy] = ::Net::SSH::Proxy::Jump.new(ssh_proxy_host) if ssh_proxy_host
options
end
def ssh_proxy_host
if raw_config.ssh && raw_config.ssh["proxy_host"]
"#{ssh_user_proxy_host}@#{raw_config.ssh['proxy_host']}"
end
end
def ssh_user_proxy_host
if raw_config.ssh.present?
raw_config.ssh["user_proxy_host"] || "root"
else
"root"
end
{ user: ssh_user, proxy: ssh_proxy, auth_methods: [ "publickey" ] }.compact
end
def master_key