Commit 4701e9cf127eabb37b1731d1237ac56f4f32db58
1 parent
13f2a507
Exists in
master
and in
17 other branches
Create cookbook definition for symlinked templates
Showing
2 changed files
with
33 additions
and
7 deletions
Show diff stats
files/gitlab-cookbooks/gitlab/definitions/template_symlink.rb
0 → 100644
| ... | ... | @@ -0,0 +1,31 @@ |
| 1 | +# | |
| 2 | +# Copyright:: Copyright (c) 2014 GitLab.com | |
| 3 | +# License:: Apache License, Version 2.0 | |
| 4 | +# | |
| 5 | +# Licensed under the Apache License, Version 2.0 (the "License"); | |
| 6 | +# you may not use this file except in compliance with the License. | |
| 7 | +# You may obtain a copy of the License at | |
| 8 | +# | |
| 9 | +# http://www.apache.org/licenses/LICENSE-2.0 | |
| 10 | +# | |
| 11 | +# Unless required by applicable law or agreed to in writing, software | |
| 12 | +# distributed under the License is distributed on an "AS IS" BASIS, | |
| 13 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 14 | +# See the License for the specific language governing permissions and | |
| 15 | +# limitations under the License. | |
| 16 | +# | |
| 17 | + | |
| 18 | +define :template_symlink, :link_from => nil, :source => nil, :owner => nil, :group => nil, :mode => nil, :variables => nil, :notifies => nil do | |
| 19 | + template params[:name] do | |
| 20 | + source params[:source] | |
| 21 | + owner params[:owner] | |
| 22 | + group params:group] | |
| 23 | + mode params[:mode] | |
| 24 | + variables params[:variables] | |
| 25 | + notifies *params[:notifies] if params[:notifies] | |
| 26 | + end | |
| 27 | + | |
| 28 | + link params[:link_from] do | |
| 29 | + to params[:name] | |
| 30 | + end | |
| 31 | +end | ... | ... |
files/gitlab-cookbooks/gitlab/recipes/gitlab-core.rb
| ... | ... | @@ -56,9 +56,8 @@ link "/opt/gitlab/embedded/service/gitlab-core/.secret" do |
| 56 | 56 | to secret_token_config |
| 57 | 57 | end |
| 58 | 58 | |
| 59 | -database_yml = File.join(gitlab_core_etc_dir, "database.yml") | |
| 60 | - | |
| 61 | -template database_yml do | |
| 59 | +template_symlink File.join(gitlab_core_etc_dir, "database.yml") do | |
| 60 | + link_from "/opt/gitlab/embedded/service/gitlab-core/config/database.yml" | |
| 62 | 61 | source "database.yml.postgresql.erb" |
| 63 | 62 | owner "root" |
| 64 | 63 | group "root" |
| ... | ... | @@ -67,10 +66,6 @@ template database_yml do |
| 67 | 66 | notifies :restart, 'service[gitlab-core]' if should_notify |
| 68 | 67 | end |
| 69 | 68 | |
| 70 | -link "/opt/gitlab/embedded/service/gitlab-core/config/database.yml" do | |
| 71 | - to database_yml | |
| 72 | -end | |
| 73 | - | |
| 74 | 69 | gitlab_yml = File.join(gitlab_core_etc_dir, "gitlab.yml") |
| 75 | 70 | |
| 76 | 71 | template gitlab_yml do | ... | ... |