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
025f97aa
Commit
025f97aa
authored
May 31, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'lock_file_location' into 'master'
Lock file location
parents
c26647b9
2c5d04de
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 @
025f97aa
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 @
025f97aa
...
@@ -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 @
025f97aa
...
@@ -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