mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-23 22:36:22 +00:00
Merge branch 'issue-10464' into panel.sutty.nl
This commit is contained in:
commit
9a6cc32a41
3 changed files with 23 additions and 6 deletions
4
Gemfile
4
Gemfile
|
@ -44,8 +44,8 @@ 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', '~> 0.2.0'
|
||||||
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'
|
||||||
gem 'fast_blank'
|
gem 'fast_blank'
|
||||||
|
|
|
@ -344,7 +344,7 @@ GEM
|
||||||
net-ssh (7.1.0)
|
net-ssh (7.1.0)
|
||||||
netaddr (2.0.6)
|
netaddr (2.0.6)
|
||||||
nio4r (2.5.8-x86_64-linux-musl)
|
nio4r (2.5.8-x86_64-linux-musl)
|
||||||
njalla-api-client (0.1.0)
|
njalla-api-client (0.2.0)
|
||||||
dry-schema
|
dry-schema
|
||||||
httparty (~> 0.18)
|
httparty (~> 0.18)
|
||||||
nokogiri (1.14.2-x86_64-linux-musl)
|
nokogiri (1.14.2-x86_64-linux-musl)
|
||||||
|
@ -568,7 +568,7 @@ DEPENDENCIES
|
||||||
devise
|
devise
|
||||||
devise-i18n
|
devise-i18n
|
||||||
devise_invitable
|
devise_invitable
|
||||||
distributed-press-api-client (~> 0.2.2)
|
distributed-press-api-client (~> 0.2.3)
|
||||||
dotenv-rails
|
dotenv-rails
|
||||||
down
|
down
|
||||||
ed25519
|
ed25519
|
||||||
|
|
|
@ -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!, :delete_njalla_records!
|
||||||
|
|
||||||
DEPENDENCIES = %i[deploy_local]
|
DEPENDENCIES = %i[deploy_local]
|
||||||
|
|
||||||
|
@ -88,7 +89,7 @@ class DeployDistributedPress < Deploy
|
||||||
#
|
#
|
||||||
# @return [DistributedPressPublisher]
|
# @return [DistributedPressPublisher]
|
||||||
def publisher
|
def publisher
|
||||||
@publisher ||= DistributedPressPublisher.first
|
@publisher ||= DistributedPressPublisher.last
|
||||||
end
|
end
|
||||||
|
|
||||||
# El cliente para actualizar el sitio
|
# El cliente para actualizar el sitio
|
||||||
|
@ -122,9 +123,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
|
||||||
|
|
||||||
|
@ -158,6 +159,22 @@ 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
|
||||||
|
|
||||||
|
def delete_njalla_records!
|
||||||
|
%[a ns cname].each do |type|
|
||||||
|
next unless (id = remote_info.dig('njalla', type, 'id'))
|
||||||
|
|
||||||
|
njalla.remove_record(id: id)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
# Actualizar registros en Njalla
|
# Actualizar registros en Njalla
|
||||||
#
|
#
|
||||||
# @return [Njalla::V1::Domain]
|
# @return [Njalla::V1::Domain]
|
||||||
|
|
Loading…
Reference in a new issue