Commit c52fd98162e473b28bc24af11c6cb9051213e39b
1 parent
c5d196c8
Exists in
master
and in
17 other branches
Add a 'restarts' parameter to template_symlink
Showing
2 changed files
with
11 additions
and
12 deletions
Show diff stats
files/gitlab-cookbooks/gitlab/definitions/template_symlink.rb
@@ -15,7 +15,7 @@ | @@ -15,7 +15,7 @@ | ||
15 | # limitations under the License. | 15 | # limitations under the License. |
16 | # | 16 | # |
17 | 17 | ||
18 | -define :template_symlink, :link_from => nil, :source => nil, :owner => nil, :group => nil, :mode => nil, :variables => nil, :notifies => nil, :notifies2 => nil do | 18 | +define :template_symlink, :link_from => nil, :source => nil, :owner => nil, :group => nil, :mode => nil, :variables => nil, :notifies => nil, :restarts => [] do |
19 | template params[:name] do | 19 | template params[:name] do |
20 | source params[:source] | 20 | source params[:source] |
21 | owner params[:owner] | 21 | owner params[:owner] |
@@ -23,7 +23,9 @@ define :template_symlink, :link_from => nil, :source => nil, :owner => nil, :gro | @@ -23,7 +23,9 @@ define :template_symlink, :link_from => nil, :source => nil, :owner => nil, :gro | ||
23 | mode params[:mode] | 23 | mode params[:mode] |
24 | variables params[:variables] | 24 | variables params[:variables] |
25 | notifies *params[:notifies] if params[:notifies] | 25 | notifies *params[:notifies] if params[:notifies] |
26 | - notifies *params[:notifies2] if params[:notifies2] | 26 | + params[:restarts].each do |resource| |
27 | + notifies :restart, resource | ||
28 | + end | ||
27 | end | 29 | end |
28 | 30 | ||
29 | link params[:link_from] do | 31 | link params[:link_from] do |
files/gitlab-cookbooks/gitlab/recipes/gitlab-rails.rb
@@ -39,8 +39,9 @@ gitlab_rails_log_dir = node['gitlab']['gitlab-rails']['log_directory'] | @@ -39,8 +39,9 @@ gitlab_rails_log_dir = node['gitlab']['gitlab-rails']['log_directory'] | ||
39 | end | 39 | end |
40 | end | 40 | end |
41 | 41 | ||
42 | -should_notify_unicorn = OmnibusHelper.should_notify?("unicorn") | ||
43 | -should_notify_sidekiq = OmnibusHelper.should_notify?("sidekiq") | 42 | +dependent_services = [] |
43 | +dependent_services << "service[unicorn]" if OmnibusHelper.should_notify?("unicorn") | ||
44 | +dependent_services << "service[sidekiq]" if OmnibusHelper.should_notify?("sidekiq") | ||
44 | 45 | ||
45 | template_symlink File.join(gitlab_rails_etc_dir, "secret") do | 46 | template_symlink File.join(gitlab_rails_etc_dir, "secret") do |
46 | link_from File.join(gitlab_rails_source_dir, ".secret") | 47 | link_from File.join(gitlab_rails_source_dir, ".secret") |
@@ -48,8 +49,7 @@ template_symlink File.join(gitlab_rails_etc_dir, "secret") do | @@ -48,8 +49,7 @@ template_symlink File.join(gitlab_rails_etc_dir, "secret") do | ||
48 | owner "root" | 49 | owner "root" |
49 | group "root" | 50 | group "root" |
50 | mode "0644" | 51 | mode "0644" |
51 | - notifies :restart, 'service[unicorn]' if should_notify_unicorn | ||
52 | - notifies2 :restart, 'service[sidekiq]' if should_notify_sidekiq | 52 | + restarts dependent_services |
53 | end | 53 | end |
54 | 54 | ||
55 | template_symlink File.join(gitlab_rails_etc_dir, "database.yml") do | 55 | template_symlink File.join(gitlab_rails_etc_dir, "database.yml") do |
@@ -59,8 +59,7 @@ template_symlink File.join(gitlab_rails_etc_dir, "database.yml") do | @@ -59,8 +59,7 @@ template_symlink File.join(gitlab_rails_etc_dir, "database.yml") do | ||
59 | group "root" | 59 | group "root" |
60 | mode "0644" | 60 | mode "0644" |
61 | variables(node['gitlab']['postgresql'].to_hash) | 61 | variables(node['gitlab']['postgresql'].to_hash) |
62 | - notifies :restart, 'service[unicorn]' if should_notify_unicorn | ||
63 | - notifies2 :restart, 'service[sidekiq]' if should_notify_sidekiq | 62 | + restarts dependent_services |
64 | end | 63 | end |
65 | 64 | ||
66 | template_symlink File.join(gitlab_rails_etc_dir, "gitlab.yml") do | 65 | template_symlink File.join(gitlab_rails_etc_dir, "gitlab.yml") do |
@@ -70,8 +69,7 @@ template_symlink File.join(gitlab_rails_etc_dir, "gitlab.yml") do | @@ -70,8 +69,7 @@ template_symlink File.join(gitlab_rails_etc_dir, "gitlab.yml") do | ||
70 | group "root" | 69 | group "root" |
71 | mode "0644" | 70 | mode "0644" |
72 | variables(node['gitlab']['gitlab-rails'].to_hash) | 71 | variables(node['gitlab']['gitlab-rails'].to_hash) |
73 | - notifies :restart, 'service[unicorn]' if should_notify_unicorn | ||
74 | - notifies2 :restart, 'service[sidekiq]' if should_notify_sidekiq | 72 | + restarts dependent_services |
75 | end | 73 | end |
76 | 74 | ||
77 | template_symlink File.join(gitlab_rails_etc_dir, "rack_attack.rb") do | 75 | template_symlink File.join(gitlab_rails_etc_dir, "rack_attack.rb") do |
@@ -81,8 +79,7 @@ template_symlink File.join(gitlab_rails_etc_dir, "rack_attack.rb") do | @@ -81,8 +79,7 @@ template_symlink File.join(gitlab_rails_etc_dir, "rack_attack.rb") do | ||
81 | group "root" | 79 | group "root" |
82 | mode "0644" | 80 | mode "0644" |
83 | variables(node['gitlab']['gitlab-rails'].to_hash) | 81 | variables(node['gitlab']['gitlab-rails'].to_hash) |
84 | - notifies :restart, 'service[unicorn]' if should_notify_unicorn | ||
85 | - notifies2 :restart, 'service[sidekiq]' if should_notify_sidekiq | 82 | + restarts dependent_services |
86 | end | 83 | end |
87 | 84 | ||
88 | directory node['gitlab']['gitlab-rails']['satellites_path'] do | 85 | directory node['gitlab']['gitlab-rails']['satellites_path'] do |