Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-shell
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
0
Merge Requests
0
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-shell
Commits
c638971d
Commit
c638971d
authored
May 31, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'add-key-lock' into 'master'
Use lock file when add new entries to authorized_keys Fixes #21
parents
025f97aa
8402c1bc
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
3 deletions
+7
-3
CHANGELOG
CHANGELOG
+1
-0
lib/gitlab_keys.rb
lib/gitlab_keys.rb
+5
-3
spec/gitlab_keys_spec.rb
spec/gitlab_keys_spec.rb
+1
-0
No files found.
CHANGELOG
View file @
c638971d
v1.9.5
- Put authorized_keys.lock in the same directory as authorized_keys
- Use lock file when add new entries to authorized_keys
v1.9.4
- Use lock file when modify authorized_keys
...
...
lib/gitlab_keys.rb
View file @
c638971d
...
...
@@ -29,9 +29,11 @@ class GitlabKeys
protected
def
add_key
$logger
.
info
"Adding key
#{
@key_id
}
=>
#{
@key
.
inspect
}
"
auth_line
=
key_line
(
@key_id
,
@key
)
open
(
auth_file
,
'a'
)
{
|
file
|
file
.
puts
(
auth_line
)
}
lock
do
$logger
.
info
"Adding key
#{
@key_id
}
=>
#{
@key
.
inspect
}
"
auth_line
=
key_line
(
@key_id
,
@key
)
open
(
auth_file
,
'a'
)
{
|
file
|
file
.
puts
(
auth_line
)
}
end
true
end
...
...
spec/gitlab_keys_spec.rb
View file @
c638971d
...
...
@@ -28,6 +28,7 @@ describe GitlabKeys do
context
"without file writing"
do
before
{
gitlab_keys
.
stub
(
:open
)
}
before
{
create_authorized_keys_fixture
}
it
"should log an add-key event"
do
$logger
.
should_receive
(
:info
).
with
(
'Adding key key-741 => "ssh-rsa AAAAB3NzaDAxx2E"'
)
...
...
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