5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-16 14:31:42 +00:00

fix: no pisar las datos de njalla con los de distributed press

This commit is contained in:
f 2023-03-31 14:38:04 -03:00
parent d2e4fe0964
commit 943bf7b5bd

View file

@ -38,7 +38,7 @@ class DeployDistributedPress < Deploy
raise DeployJob::DeployException, 'El sitio no se creó en Distributed Press'
end
if create_njalla_records? && remote_info['njalla'].blank?
if create_njalla_records? && remote_info[:njalla].blank?
raise DeployJob::DeployException, 'No se pudieron crear los registros necesarios en Njalla'
end
@ -52,7 +52,8 @@ class DeployDistributedPress < Deploy
end
end
update remote_info: c.show(publishing_site).to_h
self.remote_info[:distributed_press] = c.show(publishing_site).to_h
save
status = c.publish(publishing_site, deploy_local.destination)
@ -77,7 +78,7 @@ class DeployDistributedPress < Deploy
# Devuelve las URLs de todos los protocolos
def urls
remote_info[:links].values.map do |protocol|
remote_info.dig(:distributed_press, :links).values.map do |protocol|
[ protocol[:link], protocol[:gateway] ]
end.flatten.compact.select do |link|
link.include? '://'
@ -124,7 +125,8 @@ class DeployDistributedPress < Deploy
created_site = site_client.create(create_site)
self.remote_site_id = created_site[:id]
self.remote_info = created_site.to_h
self.remote_info ||= {}
self.remote_info[:distributed_press] = created_site.to_h
nil
rescue DistributedPress::V1::Error => e
ExceptionNotifier.notify_exception(e, data: { site: site.name })
@ -141,15 +143,15 @@ class DeployDistributedPress < Deploy
return unless create_njalla_records?
self.remote_info ||= {}
self.remote_info['njalla'] ||= {}
self.remote_info['njalla']['a'] ||= njalla.add_record(name: site.name, type: 'CNAME', content: "#{Site.domain}.").to_h
self.remote_info['njalla']['cname'] ||= njalla.add_record(name: "www.#{site.name}", type: 'CNAME', content: "#{Site.domain}.").to_h
self.remote_info['njalla']['ns'] ||= njalla.add_record(name: "_dnslink.#{site.name}", type: 'NS', content: "#{publisher.hostname}.").to_h
self.remote_info[:njalla] ||= {}
self.remote_info[:njalla][:a] ||= njalla.add_record(name: site.name, type: 'CNAME', content: "#{Site.domain}.").to_h
self.remote_info[:njalla][:cname] ||= njalla.add_record(name: "www.#{site.name}", type: 'CNAME', content: "#{Site.domain}.").to_h
self.remote_info[:njalla][:ns] ||= njalla.add_record(name: "_dnslink.#{site.name}", type: 'NS', content: "#{publisher.hostname}.").to_h
nil
rescue HTTParty::Error => e
ExceptionNotifier.notify_exception(e, data: { site: site.name })
self.remote_info['njalla'] = nil
self.remote_info.delete :njalla
ensure
nil
end