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
8126303e
Commit
8126303e
authored
Mar 21, 2016
by
Gabriel Mazetto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Notify key changes to secondary Geo
parent
eb84a5b0
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
5 deletions
+11
-5
app/models/key.rb
app/models/key.rb
+2
-0
app/services/geo/schedule_key_change_service.rb
app/services/geo/schedule_key_change_service.rb
+3
-3
lib/gitlab/geo.rb
lib/gitlab/geo.rb
+4
-0
spec/services/geo/schedule_key_change_service_spec.rb
spec/services/geo/schedule_key_change_service_spec.rb
+2
-2
No files found.
app/models/key.rb
View file @
8126303e
...
...
@@ -57,6 +57,7 @@ class Key < ActiveRecord::Base
end
def
add_to_shell
Gitlab
::
Geo
.
notify_ssh_key_change
(
id
,
:create
)
if
Gitlab
::
Geo
.
primary?
GitlabShellWorker
.
perform_async
(
:add_key
,
shell_id
,
...
...
@@ -73,6 +74,7 @@ class Key < ActiveRecord::Base
end
def
remove_from_shell
Gitlab
::
Geo
.
notify_ssh_key_change
(
id
,
:delete
)
if
Gitlab
::
Geo
.
primary?
GitlabShellWorker
.
perform_async
(
:remove_key
,
shell_id
,
...
...
app/services/geo/schedule_key_change_service.rb
View file @
8126303e
...
...
@@ -2,9 +2,9 @@ module Geo
class
ScheduleKeyChangeService
attr_reader
:id
,
:action
def
initialize
(
key_change
)
@id
=
key_
change
[
'id'
]
@action
=
key_change
[
'action'
]
def
initialize
(
key_
id
,
change
)
@id
=
key_
id
@action
=
change
end
def
execute
...
...
lib/gitlab/geo.rb
View file @
8126303e
...
...
@@ -42,6 +42,10 @@ module Gitlab
::
Geo
::
EnqueueWikiUpdateService
.
new
(
project
).
execute
end
def
self
.
notify_ssh_key_change
(
key_id
,
change
)
::
Geo
::
ScheduleKeyChangeService
(
key_id
,
change
.
to_sym
)
end
def
self
.
bulk_notify_job
Sidekiq
::
Cron
::
Job
.
find
(
'geo_bulk_notify_worker'
)
end
...
...
spec/services/geo/schedule_key_change_service_spec.rb
View file @
8126303e
require
'spec_helper'
describe
Geo
::
ScheduleKeyChangeService
,
service:
true
do
subject
(
:key_create
)
{
Geo
::
ScheduleKeyChangeService
.
new
(
{
'id'
=>
1
,
'action'
=>
'create'
}
)
}
subject
(
:key_delete
)
{
Geo
::
ScheduleKeyChangeService
.
new
(
{
'id'
=>
1
,
'action'
=>
'delete'
}
)
}
subject
(
:key_create
)
{
Geo
::
ScheduleKeyChangeService
.
new
(
1
,
:create
)
}
subject
(
:key_delete
)
{
Geo
::
ScheduleKeyChangeService
.
new
(
1
,
:delete
)
}
before
(
:each
)
{
allow_any_instance_of
(
GeoKeyRefreshWorker
).
to
receive
(
:perform
)
}
...
...
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