From a72d018f8cf3c4e14c27104835c88188ece4a462 Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Fri, 7 Feb 2014 17:51:18 +0100 Subject: [PATCH] Use template_symlink helper in gitlab-core.rb --- files/gitlab-cookbooks/gitlab/recipes/gitlab-core.rb | 32 +++++++++----------------------- files/gitlab-cookbooks/gitlab/templates/default/secret_token.erb | 1 + 2 files changed, 10 insertions(+), 23 deletions(-) create mode 100644 files/gitlab-cookbooks/gitlab/templates/default/secret_token.erb diff --git a/files/gitlab-cookbooks/gitlab/recipes/gitlab-core.rb b/files/gitlab-cookbooks/gitlab/recipes/gitlab-core.rb index 7c019ec..6bad1db 100644 --- a/files/gitlab-cookbooks/gitlab/recipes/gitlab-core.rb +++ b/files/gitlab-cookbooks/gitlab/recipes/gitlab-core.rb @@ -16,6 +16,7 @@ # limitations under the License. # +gitlab_core_source_dir = "/opt/gitlab/embedded/service/gitlab-core" gitlab_core_dir = node['gitlab']['gitlab-core']['dir'] gitlab_core_etc_dir = File.join(gitlab_core_dir, "etc") gitlab_core_working_dir = File.join(gitlab_core_dir, "working") @@ -42,22 +43,17 @@ end should_notify = OmnibusHelper.should_notify?("gitlab-core") -secret_token_config = File.join(gitlab_core_etc_dir, "secret") - -file secret_token_config do - content node['gitlab']['gitlab-core']['secret_token'] +template_symlink File.join(gitlab_core_etc_dir, "secret") do + link_from File.join(gitlab_core_source_dir, ".secret") + source "secret_token.erb" owner "root" group "root" mode "0644" notifies :restart, 'service[gitlab-core]' if should_notify end -link "/opt/gitlab/embedded/service/gitlab-core/.secret" do - to secret_token_config -end - template_symlink File.join(gitlab_core_etc_dir, "database.yml") do - link_from "/opt/gitlab/embedded/service/gitlab-core/config/database.yml" + link_from File.join(gitlab_core_source_dir, "config/database.yml") source "database.yml.postgresql.erb" owner "root" group "root" @@ -66,9 +62,8 @@ template_symlink File.join(gitlab_core_etc_dir, "database.yml") do notifies :restart, 'service[gitlab-core]' if should_notify end -gitlab_yml = File.join(gitlab_core_etc_dir, "gitlab.yml") - -template gitlab_yml do +template_symlink File.join(gitlab_core_etc_dir, "gitlab.yml") do + link_from File.join(gitlab_core_source_dir, "config/gitlab.yml") source "gitlab.yml.erb" owner "root" group "root" @@ -77,13 +72,8 @@ template gitlab_yml do notifies :restart, 'service[gitlab-core]' if should_notify end -link "/opt/gitlab/embedded/service/gitlab-core/config/gitlab.yml" do - to gitlab_yml -end - -rack_attack = File.join(gitlab_core_etc_dir, "rack_attack.rb") - -template rack_attack do +template_symlink File.join(gitlab_core_etc_dir, "rack_attack.rb") do + link_from File.join(gitlab_core_source_dir, "config/initializers/rack_attack.rb") source "rack_attack.rb.erb" owner "root" group "root" @@ -92,10 +82,6 @@ template rack_attack do notifies :restart, 'service[gitlab-core]' if should_notify end -link "/opt/gitlab/embedded/service/gitlab-core/config/initializers/rack_attack.rb" do - to rack_attack -end - directory node['gitlab']['gitlab-core']['satellites_path'] do owner node['gitlab']['user']['username'] group node['gitlab']['user']['group'] diff --git a/files/gitlab-cookbooks/gitlab/templates/default/secret_token.erb b/files/gitlab-cookbooks/gitlab/templates/default/secret_token.erb new file mode 100644 index 0000000..4251f75 --- /dev/null +++ b/files/gitlab-cookbooks/gitlab/templates/default/secret_token.erb @@ -0,0 +1 @@ +<%= node['gitlab']['gitlab-core']['secret_token'] %> -- libgit2 0.21.2