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
ecae936d
Commit
ecae936d
authored
Mar 15, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'batch_key_import' into 'master'
Batch Key Import
parents
66a484c9
090ed21e
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
6 deletions
+26
-6
CHANGELOG
CHANGELOG
+1
-1
lib/gitlab/backend/shell.rb
lib/gitlab/backend/shell.rb
+16
-0
lib/tasks/gitlab/check.rake
lib/tasks/gitlab/check.rake
+1
-1
lib/tasks/gitlab/shell.rake
lib/tasks/gitlab/shell.rake
+8
-4
No files found.
CHANGELOG
View file @
ecae936d
...
...
@@ -21,7 +21,7 @@ v 6.7.0
- Reuse the GitLab LDAP connection within each request
- Changed markdown new line behaviour to conform to markdown standards
- Fix global search
- Faster authorized_keys rebuilding in `rake gitlab:shell:setup` (requires gitlab-shell 1.8.5)
v 6.6.2
- Fix 500 error on branch/tag create or remove via UI
...
...
lib/gitlab/backend/shell.rb
View file @
ecae936d
...
...
@@ -2,6 +2,12 @@ module Gitlab
class
Shell
class
AccessDenied
<
StandardError
;
end
class
KeyAdder
<
Struct
.
new
(
:io
)
def
add_key
(
id
,
key
)
io
.
puts
(
"
#{
id
}
\t
#{
key
.
strip
}
"
)
end
end
# Init new repository
#
# name - project path with namespace
...
...
@@ -130,6 +136,16 @@ module Gitlab
system
"
#{
gitlab_shell_path
}
/bin/gitlab-keys"
,
"add-key"
,
key_id
,
key_content
end
# Batch-add keys to authorized_keys
#
# Ex.
# batch_add_keys { |adder| adder.add_key("key-42", "sha-rsa ...") }
def
batch_add_keys
(
&
block
)
IO
.
popen
(
%W(
#{
gitlab_shell_path
}
/bin/gitlab-keys batch-add-keys)
,
'w'
)
do
|
io
|
block
.
call
(
KeyAdder
.
new
(
io
))
end
end
# Remove ssh key from gitlab shell
#
# Ex.
...
...
lib/tasks/gitlab/check.rake
View file @
ecae936d
...
...
@@ -727,7 +727,7 @@ namespace :gitlab do
end
def
check_gitlab_shell
required_version
=
Gitlab
::
VersionInfo
.
new
(
1
,
8
,
4
)
required_version
=
Gitlab
::
VersionInfo
.
new
(
1
,
8
,
5
)
current_version
=
Gitlab
::
VersionInfo
.
parse
(
gitlab_shell_version
)
print
"GitLab Shell version >=
#{
required_version
}
? ... "
...
...
lib/tasks/gitlab/shell.rake
View file @
ecae936d
...
...
@@ -34,14 +34,18 @@ namespace :gitlab do
Gitlab
::
Shell
.
new
.
remove_all_keys
Gitlab
::
Shell
.
new
.
batch_add_keys
do
|
adder
|
Key
.
find_each
(
batch_size:
1000
)
do
|
key
|
if
Gitlab
::
Shell
.
new
.
add_key
(
key
.
shell_id
,
key
.
key
)
adder
.
add_key
(
key
.
shell_id
,
key
.
key
)
print
'.'
else
print
'F'
end
end
unless
$?
.
success?
puts
"Failed to add keys..."
.
red
exit
1
end
rescue
Gitlab
::
TaskAbortedByUserError
puts
"Quitting..."
.
red
exit
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