18794: Fix reload_config: don't assume restart.txt already exists.
authorTom Clegg <tom@curii.com>
Thu, 5 May 2022 16:59:45 +0000 (12:59 -0400)
committerTom Clegg <tom@curii.com>
Thu, 5 May 2022 16:59:45 +0000 (12:59 -0400)
Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom@curii.com>

services/api/config/initializers/reload_config.rb

index 0698f92ca019bedae0d5b6898c6682e87e2c149d..65f02e07a4e8bf942657358c1fd9538c7b7813af 100644 (file)
@@ -47,7 +47,11 @@ else
           restartfile = Rails.root.join('tmp', 'restart.txt')
           touchtime = Time.now
           Rails.logger.info("reload_config: mtime on #{conffile} changed to #{t}, touching #{restartfile} to #{touchtime}")
-          File.utime(touchtime, touchtime, restartfile)
+          begin
+            File.utime(touchtime, touchtime, restartfile)
+          rescue
+            File.open(restartfile, 'w') {}
+          end
           # Even if passenger doesn't notice that we hit restart.txt
           # and kill our process, there's no point waiting around to
           # hit it again.