diff --git a/app/models/deploy_rsync.rb b/app/models/deploy_rsync.rb index 721f2f1a..a9fdf991 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