diff --git a/files/gitlab-cookbooks/gitlab/definitions/template_symlink.rb b/files/gitlab-cookbooks/gitlab/definitions/template_symlink.rb new file mode 100644 index 0000000..6f217df --- /dev/null +++ b/files/gitlab-cookbooks/gitlab/definitions/template_symlink.rb @@ -0,0 +1,31 @@ +# +# Copyright:: Copyright (c) 2014 GitLab.com +# License:: Apache License, Version 2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +define :template_symlink, :link_from => nil, :source => nil, :owner => nil, :group => nil, :mode => nil, :variables => nil, :notifies => nil do + template params[:name] do + source params[:source] + owner params[:owner] + group params:group] + mode params[:mode] + variables params[:variables] + notifies *params[:notifies] if params[:notifies] + end + + link params[:link_from] do + to params[:name] + end +end diff --git a/files/gitlab-cookbooks/gitlab/recipes/gitlab-core.rb b/files/gitlab-cookbooks/gitlab/recipes/gitlab-core.rb index e166d1d..7c019ec 100644 --- a/files/gitlab-cookbooks/gitlab/recipes/gitlab-core.rb +++ b/files/gitlab-cookbooks/gitlab/recipes/gitlab-core.rb @@ -56,9 +56,8 @@ link "/opt/gitlab/embedded/service/gitlab-core/.secret" do to secret_token_config end -database_yml = File.join(gitlab_core_etc_dir, "database.yml") - -template database_yml do +template_symlink File.join(gitlab_core_etc_dir, "database.yml") do + link_from "/opt/gitlab/embedded/service/gitlab-core/config/database.yml" source "database.yml.postgresql.erb" owner "root" group "root" @@ -67,10 +66,6 @@ template database_yml do notifies :restart, 'service[gitlab-core]' if should_notify end -link "/opt/gitlab/embedded/service/gitlab-core/config/database.yml" do - to database_yml -end - gitlab_yml = File.join(gitlab_core_etc_dir, "gitlab.yml") template gitlab_yml do -- libgit2 0.21.2