Commit 025f97aa authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch 'lock_file_location' into 'master'

Lock file location
parents c26647b9 2c5d04de
v1.9.5
- Put authorized_keys.lock in the same directory as authorized_keys
v1.9.4
- Use lock file when modify authorized_keys
......
......@@ -92,6 +92,6 @@ class GitlabKeys
end
def lock_file
@lock_file ||= File.join(ROOT_PATH, "authorized_keys.lock")
@lock_file ||= auth_file + '.lock'
end
end
......@@ -96,7 +96,10 @@ describe GitlabKeys do
end
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
$logger.should_receive(:info).with('Removing key key-741')
......@@ -146,6 +149,10 @@ describe GitlabKeys do
end
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
key = GitlabKeys.new
expect do
......@@ -201,4 +208,8 @@ describe GitlabKeys do
def tmp_authorized_keys_path
File.join(ROOT_PATH, 'tmp', 'authorized_keys')
end
def tmp_lock_file_path
tmp_authorized_keys_path + '.lock'
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment