From 5930e1f5d32dd470fa9b60a231bae35a5a23e4eb Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Wed, 2 Oct 2013 19:52:35 +0100 Subject: [PATCH] Fix git repository ownership --- cookbooks/git/attributes/default.rb | 2 ++ cookbooks/git/recipes/server.rb | 8 ++++---- roles/ironbelly.rb | 2 ++ 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/cookbooks/git/attributes/default.rb b/cookbooks/git/attributes/default.rb index efeaa6aae..ebb2bd736 100644 --- a/cookbooks/git/attributes/default.rb +++ b/cookbooks/git/attributes/default.rb @@ -1 +1,3 @@ default[:git][:directory] = "/var/lib/git" +default[:git][:user] = "git" +default[:git][:group] = "git" diff --git a/cookbooks/git/recipes/server.rb b/cookbooks/git/recipes/server.rb index 4f537e62d..59ada04a8 100644 --- a/cookbooks/git/recipes/server.rb +++ b/cookbooks/git/recipes/server.rb @@ -22,8 +22,8 @@ include_recipe "networking" git_directory = node[:git][:directory] directory git_directory do - owner "git" - group "git" + owner node[:git][:user] + group node[:git][:group] mode 02775 end @@ -56,7 +56,7 @@ Dir.new(git_directory).select { |name| name =~ /\.git$/ }.each do |repository| template "#{git_directory}/#{repository}/hooks/post-update" do source "post-update.erb" owner "root" - group "git" + group node[:git][:group] mode 0755 end @@ -64,7 +64,7 @@ Dir.new(git_directory).select { |name| name =~ /\.git$/ }.each do |repository| template "#{git_directory}/#{repository}/hooks/post-receive" do source "post-receive.erb" owner "root" - group "git" + group node[:git][:group] mode 0755 variables :repository => "#{git_directory}/#{repository}" end diff --git a/roles/ironbelly.rb b/roles/ironbelly.rb index c831c995c..7c90c9c87 100644 --- a/roles/ironbelly.rb +++ b/roles/ironbelly.rb @@ -7,6 +7,8 @@ default_attributes( }, :git => { :allowed_nodes => "*:*", + :user => "chefrepo", + :group => "chefrepo", :backup => "chef-git" }, :networking => { -- 2.43.2