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
387877d4
Commit
387877d4
authored
Mar 07, 2016
by
Gabriel Mazetto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More fixes and changes after review for Geo
parent
f0bf830f
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
10 additions
and
14 deletions
+10
-14
app/models/geo_node.rb
app/models/geo_node.rb
+1
-8
app/models/geo_node_key.rb
app/models/geo_node_key.rb
+1
-1
app/views/admin/geo_nodes/index.html.haml
app/views/admin/geo_nodes/index.html.haml
+1
-1
lib/gitlab/geo.rb
lib/gitlab/geo.rb
+1
-1
lib/gitlab/git_access.rb
lib/gitlab/git_access.rb
+1
-1
spec/models/geo_node_key_spec.rb
spec/models/geo_node_key_spec.rb
+1
-1
spec/models/geo_node_spec.rb
spec/models/geo_node_spec.rb
+4
-1
No files found.
app/models/geo_node.rb
View file @
387877d4
...
...
@@ -11,7 +11,7 @@
#
class
GeoNode
<
ActiveRecord
::
Base
belongs_to
:geo_node_key
belongs_to
:geo_node_key
,
dependent: :destroy
default_values
schema:
'http'
,
host:
lambda
{
Gitlab
.
config
.
gitlab
.
host
},
...
...
@@ -29,7 +29,6 @@ class GeoNode < ActiveRecord::Base
after_initialize
:check_geo_node_key
after_save
:refresh_bulk_notify_worker_status
after_destroy
:refresh_bulk_notify_worker_status
after_destroy
:destroy_orphaned_geo_node_key
before_validation
:change_geo_node_key_title
def
uri
...
...
@@ -58,12 +57,6 @@ class GeoNode < ActiveRecord::Base
private
def
destroy_orphaned_geo_node_key
return
unless
self
.
geo_node_key
&&
self
.
geo_node_key
.
destroyed_when_orphaned?
&&
self
.
geo_node_key
.
orphaned?
self
.
geo_node_key
.
destroy
end
def
refresh_bulk_notify_worker_status
if
Gitlab
::
Geo
.
primary?
Gitlab
::
Geo
.
bulk_notify_job
.
enable!
...
...
app/models/geo_node_key.rb
View file @
387877d4
...
...
@@ -14,7 +14,7 @@
#
class
GeoNodeKey
<
Key
has_one
:geo_node
s
has_one
:geo_node
def
orphaned?
self
.
geo_nodes
.
length
==
0
...
...
app/views/admin/geo_nodes/index.html.haml
View file @
387877d4
...
...
@@ -46,7 +46,7 @@
%li
.list-item-name
%strong
=
node
.
url
%p
#{
node
.
primary
?
'Primary node'
:
'
Readonl
y node'
}
%p
#{
node
.
primary
?
'Primary node'
:
'
Secondar
y node'
}
.pull-right
=
link_to
'Remove'
,
admin_geo_node_path
(
node
),
data:
{
confirm:
'Are you sure?'
},
method: :delete
,
class:
'btn btn-remove btn-sm'
lib/gitlab/geo.rb
View file @
387877d4
...
...
@@ -25,7 +25,7 @@ module Gitlab
end
def
self
.
secondary?
RequestStore
.
store
[
:geo_node_
readonly?
]
||=
self
.
enabled?
&&
self
.
current_node
&&
!
self
.
current_node
.
primary?
RequestStore
.
store
[
:geo_node_
secondary
]
||=
self
.
enabled?
&&
self
.
current_node
&&
!
self
.
current_node
.
primary?
end
def
self
.
geo_node?
(
host
:,
port
:)
...
...
lib/gitlab/git_access.rb
View file @
387877d4
...
...
@@ -95,7 +95,7 @@ module Gitlab
def
push_access_check
(
changes
)
if
Gitlab
::
Geo
.
enabled?
&&
Gitlab
::
Geo
.
secondary?
return
build_status_object
(
false
,
"You can't push code on a secondary Git
l
ab Geo node."
)
return
build_status_object
(
false
,
"You can't push code on a secondary Git
L
ab Geo node."
)
end
return
build_status_object
(
true
)
if
git_annex_branch_sync?
(
changes
)
...
...
spec/models/geo_node_key_spec.rb
View file @
387877d4
...
...
@@ -20,6 +20,6 @@ describe GeoNodeKey, models: true do
let
(
:geo_node_key
)
{
create
(
:geo_node_key
,
geo_nodes:
[
geo_node
])
}
describe
'Associations'
do
it
{
is_expected
.
to
have_
many
(
:geo_nodes
)
}
it
{
is_expected
.
to
have_
one
(
:geo_node
)
}
end
end
spec/models/geo_node_spec.rb
View file @
387877d4
...
...
@@ -3,6 +3,10 @@ require 'spec_helper'
describe
GeoNode
,
type: :model
do
let
(
:dummy_url
)
{
'https://localhost:3000/gitlab'
}
context
'associations'
do
it
{
is_expected
.
to
belong_to
(
:geo_node_key
).
dependent
(
:destroy
)
}
end
context
'default values'
do
let
(
:gitlab_host
)
{
'gitlabhost'
}
before
(
:each
)
{
allow
(
Gitlab
.
config
.
gitlab
).
to
receive
(
:host
)
{
gitlab_host
}
}
...
...
@@ -105,5 +109,4 @@ describe GeoNode, type: :model do
expect
(
subject
.
notify_url
).
to
eq
(
refresh_url
)
end
end
end
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