keys to gitolite via sidekiq now

This commit is contained in:
Dmitriy Zaporozhets 2013-01-28 21:02:10 +02:00
parent 944b2450b1
commit 299a9a1040
3 changed files with 30 additions and 6 deletions

View file

@ -8,14 +8,28 @@ module Gitlab
Gitlab::GitoliteConfig.new
end
def set_key key_id, key_content, projects
# Update gitolite config with new key
#
# Ex.
# set_key("m_gitlab_com_12343", "sha-rsa ...", [2, 3, 6])
#
def set_key(key_id, key_content, project_ids)
projects = Project.where(id: project_ids)
config.apply do |config|
config.write_key(key_id, key_content)
config.update_projects(projects)
end
end
def remove_key key_id, projects
# Remove ssh key from gitolite config
#
# Ex.
# remove_key("m_gitlab_com_12343", [2, 3, 6])
#
def remove_key(key_id, project_ids)
projects = Project.where(id: project_ids)
config.apply do |config|
config.rm_key(key_id)
config.update_projects(projects)