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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-shell
Commits
2c5d04de
Commit
2c5d04de
authored
May 30, 2014
by
Jacob Vosmaer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Put authorized_keys.lock in the .ssh directory
parent
c26647b9
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
2 deletions
+16
-2
CHANGELOG
CHANGELOG
+3
-0
lib/gitlab_keys.rb
lib/gitlab_keys.rb
+1
-1
spec/gitlab_keys_spec.rb
spec/gitlab_keys_spec.rb
+12
-1
No files found.
CHANGELOG
View file @
2c5d04de
v1.9.5
- Put authorized_keys.lock in the same directory as authorized_keys
v1.9.4
v1.9.4
- Use lock file when modify authorized_keys
- Use lock file when modify authorized_keys
...
...
lib/gitlab_keys.rb
View file @
2c5d04de
...
@@ -92,6 +92,6 @@ class GitlabKeys
...
@@ -92,6 +92,6 @@ class GitlabKeys
end
end
def
lock_file
def
lock_file
@lock_file
||=
File
.
join
(
ROOT_PATH
,
"authorized_keys.lock"
)
@lock_file
||=
auth_file
+
'.lock'
end
end
end
end
spec/gitlab_keys_spec.rb
View file @
2c5d04de
...
@@ -96,7 +96,10 @@ describe GitlabKeys do
...
@@ -96,7 +96,10 @@ describe GitlabKeys do
end
end
context
"without file writing"
do
context
"without file writing"
do
before
{
Tempfile
.
stub
(
:open
)
}
before
do
Tempfile
.
stub
(
:open
)
gitlab_keys
.
stub
(
:lock
).
and_yield
end
it
"should log an rm-key event"
do
it
"should log an rm-key event"
do
$logger
.
should_receive
(
:info
).
with
(
'Removing key key-741'
)
$logger
.
should_receive
(
:info
).
with
(
'Removing key key-741'
)
...
@@ -146,6 +149,10 @@ describe GitlabKeys do
...
@@ -146,6 +149,10 @@ describe GitlabKeys do
end
end
describe
:lock
do
describe
:lock
do
before
do
GitlabKeys
.
any_instance
.
stub
(
lock_file:
tmp_lock_file_path
)
end
it
"should raise exception if operation lasts more then timeout"
do
it
"should raise exception if operation lasts more then timeout"
do
key
=
GitlabKeys
.
new
key
=
GitlabKeys
.
new
expect
do
expect
do
...
@@ -201,4 +208,8 @@ describe GitlabKeys do
...
@@ -201,4 +208,8 @@ describe GitlabKeys do
def
tmp_authorized_keys_path
def
tmp_authorized_keys_path
File
.
join
(
ROOT_PATH
,
'tmp'
,
'authorized_keys'
)
File
.
join
(
ROOT_PATH
,
'tmp'
,
'authorized_keys'
)
end
end
def
tmp_lock_file_path
tmp_authorized_keys_path
+
'.lock'
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