5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-22 19:26:21 +00:00

feat: indicarle a distributed press que elimine el sitio

sutty/distributed-press-api-client#10
This commit is contained in:
f 2023-03-31 12:14:14 -03:00
parent fd9d68b3df
commit d4f5bb60ee
2 changed files with 11 additions and 2 deletions

View file

@ -39,7 +39,7 @@ gem 'commonmarker'
gem 'devise' gem 'devise'
gem 'devise-i18n' gem 'devise-i18n'
gem 'devise_invitable' gem 'devise_invitable'
gem 'distributed-press-api-client', '~> 0.2.2' gem 'distributed-press-api-client', '~> 0.2.3'
gem 'njalla-api-client' gem 'njalla-api-client'
gem 'email_address', git: 'https://github.com/fauno/email_address', branch: 'i18n' gem 'email_address', git: 'https://github.com/fauno/email_address', branch: 'i18n'
gem 'exception_notification' gem 'exception_notification'

View file

@ -16,6 +16,7 @@ class DeployDistributedPress < Deploy
store :values, accessors: %i[hostname remote_site_id remote_info], coder: JSON store :values, accessors: %i[hostname remote_site_id remote_info], coder: JSON
before_create :create_remote_site!, :create_njalla_records! before_create :create_remote_site!, :create_njalla_records!
before_destroy :delete_remote_site!
DEPENDENCIES = %i[deploy_local] DEPENDENCIES = %i[deploy_local]
@ -120,9 +121,9 @@ class DeployDistributedPress < Deploy
self.remote_site_id = created_site[:id] self.remote_site_id = created_site[:id]
self.remote_info = created_site.to_h self.remote_info = created_site.to_h
nil
rescue DistributedPress::V1::Error => e rescue DistributedPress::V1::Error => e
ExceptionNotifier.notify_exception(e, data: { site: site.name }) ExceptionNotifier.notify_exception(e, data: { site: site.name })
ensure
nil nil
end end
@ -156,6 +157,14 @@ class DeployDistributedPress < Deploy
nil nil
end end
def delete_remote_site!
site_client.destroy(publishing_site)
nil
rescue DistributedPress::V1::Error => e
ExceptionNotifier.notify_exception(e, data: { site: site.name })
nil
end
# Actualizar registros en Njalla # Actualizar registros en Njalla
# #
# @return [Njalla::V1::Domain] # @return [Njalla::V1::Domain]