diff --git a/files/gitlab-cookbooks/gitlab/definitions/template_symlink.rb b/files/gitlab-cookbooks/gitlab/definitions/template_symlink.rb index 9764f80..9b68bef 100644 --- a/files/gitlab-cookbooks/gitlab/definitions/template_symlink.rb +++ b/files/gitlab-cookbooks/gitlab/definitions/template_symlink.rb @@ -15,7 +15,7 @@ # limitations under the License. # -define :template_symlink, :link_from => nil, :source => nil, :owner => nil, :group => nil, :mode => nil, :variables => nil, :notifies => nil, :notifies2 => nil do +define :template_symlink, :link_from => nil, :source => nil, :owner => nil, :group => nil, :mode => nil, :variables => nil, :notifies => nil, :restarts => [] do template params[:name] do source params[:source] owner params[:owner] @@ -23,7 +23,9 @@ define :template_symlink, :link_from => nil, :source => nil, :owner => nil, :gro mode params[:mode] variables params[:variables] notifies *params[:notifies] if params[:notifies] - notifies *params[:notifies2] if params[:notifies2] + params[:restarts].each do |resource| + notifies :restart, resource + end end link params[:link_from] do diff --git a/files/gitlab-cookbooks/gitlab/recipes/gitlab-rails.rb b/files/gitlab-cookbooks/gitlab/recipes/gitlab-rails.rb index 765819d..7dbfd95 100644 --- a/files/gitlab-cookbooks/gitlab/recipes/gitlab-rails.rb +++ b/files/gitlab-cookbooks/gitlab/recipes/gitlab-rails.rb @@ -39,8 +39,9 @@ gitlab_rails_log_dir = node['gitlab']['gitlab-rails']['log_directory'] end end -should_notify_unicorn = OmnibusHelper.should_notify?("unicorn") -should_notify_sidekiq = OmnibusHelper.should_notify?("sidekiq") +dependent_services = [] +dependent_services << "service[unicorn]" if OmnibusHelper.should_notify?("unicorn") +dependent_services << "service[sidekiq]" if OmnibusHelper.should_notify?("sidekiq") template_symlink File.join(gitlab_rails_etc_dir, "secret") do link_from File.join(gitlab_rails_source_dir, ".secret") @@ -48,8 +49,7 @@ template_symlink File.join(gitlab_rails_etc_dir, "secret") do owner "root" group "root" mode "0644" - notifies :restart, 'service[unicorn]' if should_notify_unicorn - notifies2 :restart, 'service[sidekiq]' if should_notify_sidekiq + restarts dependent_services end 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 group "root" mode "0644" variables(node['gitlab']['postgresql'].to_hash) - notifies :restart, 'service[unicorn]' if should_notify_unicorn - notifies2 :restart, 'service[sidekiq]' if should_notify_sidekiq + restarts dependent_services end 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 group "root" mode "0644" variables(node['gitlab']['gitlab-rails'].to_hash) - notifies :restart, 'service[unicorn]' if should_notify_unicorn - notifies2 :restart, 'service[sidekiq]' if should_notify_sidekiq + restarts dependent_services end 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 group "root" mode "0644" variables(node['gitlab']['gitlab-rails'].to_hash) - notifies :restart, 'service[unicorn]' if should_notify_unicorn - notifies2 :restart, 'service[sidekiq]' if should_notify_sidekiq + restarts dependent_services end directory node['gitlab']['gitlab-rails']['satellites_path'] do -- libgit2 0.21.2