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
4949edce
Commit
4949edce
authored
Jun 28, 2017
by
Michael Kozono
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add logs for action taken
parent
17fc5fc5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
0 deletions
+5
-0
lib/gitlab/background_migration/update_authorized_keys_file_since.rb
...background_migration/update_authorized_keys_file_since.rb
+2
-0
lib/gitlab/shell.rb
lib/gitlab/shell.rb
+3
-0
No files found.
lib/gitlab/background_migration/update_authorized_keys_file_since.rb
View file @
4949edce
...
...
@@ -26,6 +26,8 @@ module Gitlab
# Not added to Gitlab::Shell because I don't expect this to be used again
def
batch_add_keys_in_db_starting_from
(
start_id
)
Rails
.
logger
.
info
(
"Adding all keys starting from ID:
#{
start_id
}
"
)
gitlab_shell
.
batch_add_keys
do
|
adder
|
Key
.
find_each
(
start:
start_id
,
batch_size:
1000
)
do
|
key
|
adder
.
add_key
(
key
.
shell_id
,
key
.
key
)
...
...
lib/gitlab/shell.rb
View file @
4949edce
...
...
@@ -247,6 +247,8 @@ module Gitlab
def
remove_keys_not_found_in_db
return
unless
self
.
authorized_keys_enabled?
Rails
.
logger
.
info
(
"Removing keys not found in DB"
)
batch_read_key_ids
do
|
ids_in_file
|
ids_in_file
.
uniq!
keys_in_db
=
Key
.
where
(
id:
ids_in_file
)
...
...
@@ -255,6 +257,7 @@ module Gitlab
ids_to_remove
=
ids_in_file
-
keys_in_db
.
pluck
(
:id
)
ids_to_remove
.
each
do
|
id
|
Rails
.
logger
.
info
(
"Removing key-
#{
id
}
not found in DB"
)
remove_key
(
"key-
#{
id
}
"
)
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