diff --git a/app/models/deploy_full_rsync.rb b/app/models/deploy_full_rsync.rb index 5bdfeeff..a3c1840d 100644 --- a/app/models/deploy_full_rsync.rb +++ b/app/models/deploy_full_rsync.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true class DeployFullRsync < DeployRsync - DEPENDENCIES = %i[ + SOFT_DEPENDENCIES = %i[ deploy_alternative_domain deploy_hidden_service deploy_local @@ -9,16 +9,24 @@ class DeployFullRsync < DeployRsync deploy_zip ] - # Sincroniza las ubicaciones alternativas también + # Sincroniza las ubicaciones alternativas también, ignorando las que + # todavía no se generaron. Solo falla si ningún sitio fue + # sincronizado o si alguna sincronización falló. # # @param :output [Boolean] # @return [Boolean] def rsync(output: false) - DEPENDENCIES.map(&:to_s).map(&:classify).map do |dependency| - site.deploys.where(type: dependency).find_each.map do |deploy| - run %(rsync -aviH --delete-after --timeout=5 #{Shellwords.escape deploy.destination} #{Shellwords.escape destination}), output: output - end - end.flatten.all? + result = + SOFT_DEPENDENCIES.map(&:to_s).map(&:classify).map do |dependency| + site.deploys.where(type: dependency).find_each.map do |deploy| + next unless File.exist? deploy.destination + + run %(rsync -aviH --delete-after --timeout=5 #{Shellwords.escape deploy.destination} #{Shellwords.escape destination}), output: output + rescue StandardError + end + end.flatten.compact + + result.present? && result.all? end def url