mirror of
https://0xacab.org/sutty/sutty
synced 2025-02-23 04:31:49 +00:00
fix: rsync
This commit is contained in:
parent
93011f7172
commit
da98a912dc
1 changed files with 5 additions and 10 deletions
|
@ -10,6 +10,8 @@ class DeployRsync < Deploy
|
||||||
DEPENDENCIES = %i[deploy_local deploy_zip]
|
DEPENDENCIES = %i[deploy_local deploy_zip]
|
||||||
|
|
||||||
def deploy(output: false)
|
def deploy(output: false)
|
||||||
|
raise(ArgumentError, 'destination no está configurado') if destination.blank?
|
||||||
|
|
||||||
ssh? && rsync(output: output)
|
ssh? && rsync(output: output)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -20,13 +22,6 @@ class DeployRsync < Deploy
|
||||||
deploy_local.size
|
deploy_local.size
|
||||||
end
|
end
|
||||||
|
|
||||||
# Devolver el destino o lanzar un error si no está configurado
|
|
||||||
def destination
|
|
||||||
values[:destination].tap do |d|
|
|
||||||
raise(ArgumentError, 'destination no está configurado') if d.blank?
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# @return [String]
|
# @return [String]
|
||||||
def url
|
def url
|
||||||
"https://#{hostname}/"
|
"https://#{hostname}/"
|
||||||
|
@ -45,9 +40,9 @@ class DeployRsync < Deploy
|
||||||
ssh_available = false
|
ssh_available = false
|
||||||
|
|
||||||
Net::SSH.start(host, user, verify_host_key: tofu, timeout: 5) do |ssh|
|
Net::SSH.start(host, user, verify_host_key: tofu, timeout: 5) do |ssh|
|
||||||
if values[:host_keys].blank?
|
if self.host_keys.blank?
|
||||||
# Guardar las llaves que se encontraron en la primera conexión
|
# Guardar las llaves que se encontraron en la primera conexión
|
||||||
values[:host_keys] = ssh.transport.host_keys.map do |host_key|
|
self.host_keys = ssh.transport.host_keys.map do |host_key|
|
||||||
"#{host_key.ssh_type} #{host_key.fingerprint}"
|
"#{host_key.ssh_type} #{host_key.fingerprint}"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -76,7 +71,7 @@ class DeployRsync < Deploy
|
||||||
#
|
#
|
||||||
# @return [Symbol]
|
# @return [Symbol]
|
||||||
def tofu
|
def tofu
|
||||||
values[:host_keys].present? ? :always : :accept_new
|
self.host_keys.present? ? :always : :accept_new
|
||||||
end
|
end
|
||||||
|
|
||||||
# Devuelve el par user host
|
# Devuelve el par user host
|
||||||
|
|
Loading…
Reference in a new issue