Commit b994a65f authored by randx's avatar randx

change gitolite backend behaviour to prevent error when config directory removed

parent 79021e67
...@@ -5,7 +5,7 @@ module Gitlab ...@@ -5,7 +5,7 @@ module Gitlab
class AccessDenied < StandardError; end class AccessDenied < StandardError; end
def config def config
@config ||= Gitlab::GitoliteConfig.new Gitlab::GitoliteConfig.new
end end
def set_key key_id, key_content, projects def set_key key_id, key_content, projects
......
...@@ -4,8 +4,10 @@ require 'fileutils' ...@@ -4,8 +4,10 @@ require 'fileutils'
module Gitlab module Gitlab
class GitoliteConfig class GitoliteConfig
def config_tmp_dir attr_reader :config_tmp_dir
@config_tmp_dir ||= File.join(Rails.root, 'tmp',"gitlabhq-gitolite-#{Time.now.to_i}")
def reset_config_tmp_dir
@config_tmp_dir = File.join(Rails.root, 'tmp',"gitlabhq-gitolite-#{Time.now.to_i}")
end end
def apply def apply
...@@ -13,9 +15,11 @@ module Gitlab ...@@ -13,9 +15,11 @@ module Gitlab
File.open(File.join(Rails.root, 'tmp', "gitlabhq-gitolite.lock"), "w+") do |f| File.open(File.join(Rails.root, 'tmp', "gitlabhq-gitolite.lock"), "w+") do |f|
begin begin
f.flock(File::LOCK_EX) f.flock(File::LOCK_EX)
reset_config_tmp_dir
pull pull
yield(self) yield(self)
push push
FileUtils.rm_rf(config_tmp_dir)
ensure ensure
f.flock(File::LOCK_UN) f.flock(File::LOCK_UN)
end end
...@@ -160,8 +164,6 @@ module Gitlab ...@@ -160,8 +164,6 @@ module Gitlab
`git commit -am "GitLab"` `git commit -am "GitLab"`
`git push` `git push`
Dir.chdir(Rails.root) Dir.chdir(Rails.root)
FileUtils.rm_rf(config_tmp_dir)
end end
end end
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