5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-16 13:41:41 +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 b759398a4e
commit b818408f3e
3 changed files with 12 additions and 3 deletions

View file

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

View file

@ -622,7 +622,7 @@ DEPENDENCIES
devise
devise-i18n
devise_invitable
distributed-press-api-client (~> 0.2.2)
distributed-press-api-client (~> 0.2.3)
dotenv-rails
down
ed25519

View file

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