]> git.openstreetmap.org Git - chef.git/commitdiff
otrs: ensure SetPermissions.pl and daemon restart happen in correct order
authorGrant Slater <github@firefishy.com>
Fri, 5 Apr 2024 15:36:45 +0000 (16:36 +0100)
committerGrant Slater <github@firefishy.com>
Fri, 5 Apr 2024 15:36:45 +0000 (16:36 +0100)
cookbooks/otrs/recipes/default.rb

index 3ffc70f628c0d15529605cb7ca0ddce6ec79c8e5..66b2219dd30d6782b4184670549ff896cf6c9ad3 100644 (file)
@@ -126,18 +126,19 @@ file "/opt/znuny-#{version}/Kernel/Config.pm" do
   group "www-data"
   mode "664"
   content config
+  notifies :restart, "service[otrs]"
 end
 
-link "/opt/otrs" do
-  to "/opt/znuny-#{version}"
-end
-
-execute "/opt/otrs/bin/otrs.SetPermissions.pl" do
-  action :run
-  command "/opt/otrs/bin/otrs.SetPermissions.pl --otrs-user=#{user} --web-group=www-data /opt/otrs-#{version}"
+execute "/opt/znuny-#{version}/bin/otrs.SetPermissions.pl" do
+  action :nothing
+  command "/opt/znuny-#{version}/bin/otrs.SetPermissions.pl --otrs-user=#{user} --web-group=www-data /opt/znuny-#{version}"
   user "root"
   group "root"
-  only_if { File.stat("/opt/otrs/README.md").uid != Etc.getpwnam("otrs").uid }
+  subscribes :run, "execute[untar-znuny-#{version}]"
+end
+
+link "/opt/otrs" do
+  to "/opt/znuny-#{version}"
 end
 
 systemd_service "otrs" do
@@ -154,6 +155,7 @@ end
 
 service "otrs" do
   action [:enable, :start]
+  subscribes :restart, "link[/opt/otrs]"
   subscribes :restart, "systemd_service[otrs]"
 end