From da98a912dcd25bc584bd50507b63b5110622798f Mon Sep 17 00:00:00 2001 From: f Date: Mon, 23 Dec 2024 17:28:44 -0300 Subject: [PATCH] fix: rsync --- app/models/deploy_rsync.rb | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/app/models/deploy_rsync.rb b/app/models/deploy_rsync.rb index a85c2d02..50aafd70 100644 --- a/app/models/deploy_rsync.rb +++ b/app/models/deploy_rsync.rb @@ -10,6 +10,8 @@ class DeployRsync < Deploy DEPENDENCIES = %i[deploy_local deploy_zip] def deploy(output: false) + raise(ArgumentError, 'destination no está configurado') if destination.blank? + ssh? && rsync(output: output) end @@ -20,13 +22,6 @@ class DeployRsync < Deploy deploy_local.size 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] def url "https://#{hostname}/" @@ -45,9 +40,9 @@ class DeployRsync < Deploy ssh_available = false 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 - 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}" end @@ -76,7 +71,7 @@ class DeployRsync < Deploy # # @return [Symbol] def tofu - values[:host_keys].present? ? :always : :accept_new + self.host_keys.present? ? :always : :accept_new end # Devuelve el par user host