Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
1960fee8
Commit
1960fee8
authored
Jun 18, 2019
by
Gabriel Mazetto
Committed by
Douglas Barbosa Alexandre
Jun 18, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Resolve "Geo: Make hashed storage a hard requirement in 12.0"
parent
6f9ee533
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
3 deletions
+32
-3
ee/app/models/geo_node.rb
ee/app/models/geo_node.rb
+10
-2
ee/changelogs/unreleased/8690-geo-require-hashed-storage.yml
ee/changelogs/unreleased/8690-geo-require-hashed-storage.yml
+5
-0
ee/spec/models/geo_node_spec.rb
ee/spec/models/geo_node_spec.rb
+17
-1
No files found.
ee/app/models/geo_node.rb
View file @
1960fee8
...
...
@@ -37,7 +37,8 @@ class GeoNode < ApplicationRecord
validates
:verification_max_capacity
,
numericality:
{
greater_than_or_equal_to:
0
}
validates
:minimum_reverification_interval
,
numericality:
{
greater_than_or_equal_to:
1
}
validate
:check_not_adding_primary_as_secondary
,
if: :secondary?
validate
:require_current_node_to_be_primary
,
if: :secondary?
validate
:require_hashed_storage
,
on: :create
after_save
:expire_cache!
after_destroy
:expire_cache!
...
...
@@ -287,12 +288,19 @@ class GeoNode < ApplicationRecord
end
# Prevent locking yourself out
def
check_not_adding_primary_as_second
ary
def
require_current_node_to_be_prim
ary
if
name
==
self
.
class
.
current_node_name
errors
.
add
(
:base
,
'Current node must be the primary node or you will be locking yourself out'
)
end
end
# Prevent creating a Geo Node unless Hashed Storage is enabled
def
require_hashed_storage
unless
Gitlab
::
CurrentSettings
.
hashed_storage_enabled?
errors
.
add
(
:base
,
'Hashed Storage must be enabled to use Geo'
)
end
end
def
update_clone_url
self
.
clone_url_prefix
=
Gitlab
.
config
.
gitlab_shell
.
ssh_path_prefix
end
...
...
ee/changelogs/unreleased/8690-geo-require-hashed-storage.yml
0 → 100644
View file @
1960fee8
---
title
:
Require Hashed Storage to be enabled to create new Geo Nodes
merge_request
:
14102
author
:
type
:
changed
ee/spec/models/geo_node_spec.rb
View file @
1960fee8
...
...
@@ -94,6 +94,22 @@ describe GeoNode, :geo, type: :model do
it
{
is_expected
.
not_to
be_valid
}
end
end
context
'when validating requirement for hashed storage'
do
subject
{
build
(
:geo_node
)
}
context
'when hashed storage is enabled'
do
it
{
is_expected
.
to
be_valid
}
end
context
'when hashed_storage is disabled'
do
before
do
stub_application_setting
(
hashed_storage_enabled:
false
)
end
it
{
is_expected
.
to
be_invalid
}
end
end
end
context
'default values'
do
...
...
@@ -110,7 +126,7 @@ describe GeoNode, :geo, type: :model do
context
'prevent locking yourself out'
do
it
'does not accept adding a non primary node with same details as current_node'
do
stub_geo_setting
(
node_name:
'foo'
)
node
=
build
(
:geo_node
,
:primary
,
primary:
false
,
name:
'foo'
)
node
=
build
(
:geo_node
,
primary:
false
,
name:
'foo'
)
expect
(
node
).
not_to
be_valid
expect
(
node
.
errors
.
full_messages
.
count
).
to
eq
(
1
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment