Commit 2f693e155798d126c827cccc35a8c68c1eeee11a
Exists in
master
and in
17 other branches
Merge branch 'template_symlink_notifies2' into 'master'
Template Symlink Notifications
Showing
2 changed files
with
11 additions
and
11 deletions
Show diff stats
files/gitlab-cookbooks/gitlab/definitions/template_symlink.rb
... | ... | @@ -15,7 +15,7 @@ |
15 | 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 do | |
18 | +define :template_symlink, :link_from => nil, :source => nil, :owner => nil, :group => nil, :mode => nil, :variables => nil, :notifies => nil, :restarts => [] do | |
19 | 19 | template params[:name] do |
20 | 20 | source params[:source] |
21 | 21 | owner params[:owner] |
... | ... | @@ -23,6 +23,9 @@ define :template_symlink, :link_from => nil, :source => nil, :owner => nil, :gro |
23 | 23 | mode params[:mode] |
24 | 24 | variables params[:variables] |
25 | 25 | notifies *params[:notifies] if params[:notifies] |
26 | + params[:restarts].each do |resource| | |
27 | + notifies :restart, resource | |
28 | + end | |
26 | 29 | end |
27 | 30 | |
28 | 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 | 39 | end |
40 | 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 | 46 | template_symlink File.join(gitlab_rails_etc_dir, "secret") do |
46 | 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 | 49 | owner "root" |
49 | 50 | group "root" |
50 | 51 | mode "0644" |
51 | - notifies :restart, 'service[unicorn]' if should_notify_unicorn | |
52 | - notifies :restart, 'service[sidekiq]' if should_notify_sidekiq | |
52 | + restarts dependent_services | |
53 | 53 | end |
54 | 54 | |
55 | 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 | 59 | group "root" |
60 | 60 | mode "0644" |
61 | 61 | variables(node['gitlab']['postgresql'].to_hash) |
62 | - notifies :restart, 'service[unicorn]' if should_notify_unicorn | |
63 | - notifies :restart, 'service[sidekiq]' if should_notify_sidekiq | |
62 | + restarts dependent_services | |
64 | 63 | end |
65 | 64 | |
66 | 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 | 69 | group "root" |
71 | 70 | mode "0644" |
72 | 71 | variables(node['gitlab']['gitlab-rails'].to_hash) |
73 | - notifies :restart, 'service[unicorn]' if should_notify_unicorn | |
74 | - notifies :restart, 'service[sidekiq]' if should_notify_sidekiq | |
72 | + restarts dependent_services | |
75 | 73 | end |
76 | 74 | |
77 | 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 | 79 | group "root" |
82 | 80 | mode "0644" |
83 | 81 | variables(node['gitlab']['gitlab-rails'].to_hash) |
84 | - notifies :restart, 'service[unicorn]' if should_notify_unicorn | |
85 | - notifies :restart, 'service[sidekiq]' if should_notify_sidekiq | |
82 | + restarts dependent_services | |
86 | 83 | end |
87 | 84 | |
88 | 85 | directory node['gitlab']['gitlab-rails']['satellites_path'] do | ... | ... |