Commit 60a48ef7 authored by Gabriel Mazetto's avatar Gabriel Mazetto Committed by Michael Kozono

Expose sync_object_storage in the Geo Node API

parent 91f7b726
......@@ -22,6 +22,7 @@ class GeoNode < ApplicationRecord
validates :primary, uniqueness: { message: 'node already exists' }, if: :primary
validates :enabled, if: :primary, acceptance: { message: 'Geo primary node cannot be disabled' }
validates :sync_object_storage, if: :primary, inclusion: { in: [false], message: 'Geo primary node doesnt use sync_object_storage value' }
validates :access_key, presence: true
validates :encrypted_secret_access_key, presence: true
......
......@@ -147,6 +147,7 @@ module API
optional :repos_max_capacity, type: Integer, desc: 'Control the maximum concurrency of repository backfill for this secondary node'
optional :verification_max_capacity, type: Integer, desc: 'Control the maximum concurrency of repository verification for this node'
optional :container_repositories_max_capacity, type: Integer, desc: 'Control the maximum concurrency of container repository sync for this node'
optional :sync_object_storage, type: Boolean, desc: 'Flag indicating if the secondary Geo node will handle replication for blobs on the Object Storage'
end
put do
not_found!('GeoNode') unless geo_node
......
......@@ -485,6 +485,7 @@ module EE
expose :repos_max_capacity
expose :verification_max_capacity
expose :container_repositories_max_capacity
expose :sync_object_storage, if: ->(geo_node, _) { geo_node.secondary? }
# Retained for backwards compatibility. Remove in API v5
expose :clone_protocol do |_record, _options|
......
......@@ -43,6 +43,13 @@ describe GeoNode, :geo, type: :model do
expect(primary_node).not_to be_valid
expect(primary_node.errors).to include(:enabled)
end
it 'requires sync_object_storage to be disabled' do
primary_node.sync_object_storage = true
expect(primary_node).not_to be_valid
expect(primary_node.errors).to include(:sync_object_storage)
end
end
context 'when validating url' do
......@@ -118,6 +125,7 @@ describe GeoNode, :geo, type: :model do
:repos_max_capacity | 25
:files_max_capacity | 10
:container_repositories_max_capacity | 10
:sync_object_storage | false
end
with_them do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment