Skip to content
This repository
Browse code

Teach deploy:web:enable to fail gracefully

Don't fail if the maintenance files does not exist. This could happen if
multiple web servers share their #{shared_path}/system folder, the rm
would succeed on the first web box and fail on others in this case.
  • Loading branch information...
commit 22a1c8b7097b1fa602b756f503d17253c0c4e98b 1 parent 6543a8f
Lee Marlow authored February 21, 2012

Showing 1 changed file with 2 additions and 2 deletions. Show diff stats Hide diff stats

  1. 4  lib/capistrano/recipes/deploy.rb
4  lib/capistrano/recipes/deploy.rb
@@ -546,7 +546,7 @@ def try_runner(*args)
546 546
     DESC
547 547
     task :disable, :roles => :web, :except => { :no_release => true } do
548 548
       require 'erb'
549  
-      on_rollback { run "rm #{shared_path}/system/#{maintenance_basename}.html" }
  549
+      on_rollback { run "rm -f #{shared_path}/system/#{maintenance_basename}.html" }
550 550
 
551 551
       warn <<-EOHTACCESS
552 552
 
@@ -588,7 +588,7 @@ def try_runner(*args)
588 588
       web-accessible again.
589 589
     DESC
590 590
     task :enable, :roles => :web, :except => { :no_release => true } do
591  
-      run "rm #{shared_path}/system/#{maintenance_basename}.html"
  591
+      run "rm -f #{shared_path}/system/#{maintenance_basename}.html"
592 592
     end
593 593
   end
594 594
 end

0 notes on commit 22a1c8b

Please sign in to comment.
Something went wrong with that request. Please try again.