tasks that refuse to run after they fail twice

8 views
Skip to first unread message

patcoll

unread,
Oct 28, 2009, 2:27:21 PM10/28/09
to Capistrano
I have two custom "restart" tasks that restart apache and nginx,
respectively. I put :on_error => :continue on both.

After the Apache "restart" throws an error twice in the same script
(my fault), any subsequent calls to that task seem to get ignored...

Has anyone else experienced this? I can see how this may be a feature
for one call to "cap" on the command line, but the behavior persists
to the next time I use "cap" -- does the result of each task get
cached somehow?

Lee Hambley

unread,
Oct 28, 2009, 2:38:01 PM10/28/09
to capis...@googlegroups.com
Pat, please see guidelines here and post back – http://groups.google.com/group/capistrano

-- Lee Hambley

Twitter: @leehambley | @capistranorb
Blog: http://lee.hambley.name/
Working with Rails: http://is.gd/1s5W1


2009/10/28 patcoll <pat...@gmail.com>

patcoll

unread,
Oct 28, 2009, 3:00:53 PM10/28/09
to Capistrano
I'm using cap to setup an Ubuntu appliance to use as an app server
with a LAMP (PHP) stack.

Here's the output of what I see...

http://pastie.org/673712

I have :on_error => :continue on the "appliance:apache:restart" task,
so it correctly continues the first time, but the next time it
encounters "appliance:apache:restart" it seems to ignore it (in this
case it continues on to execute "appliance:php:install").

Then I run the same "cap" command on the command line. In this case, I
have an "after('deploy:setup')" block that goes on to install the LAMP
stack. Soo when I run the same cmd again, and it gets to the
"appliance:apache:restart" part, cap ignores it completely:

* executing `appliance:apache:restart'
* executing "/etc/init.d/apache2 restart"

And nothing after that.

ruby 1.8.7
capistrano 2.5.9

On Oct 28, 2:38 pm, Lee Hambley <lee.hamb...@gmail.com> wrote:
> Pat, please see guidelines here and post back –http://groups.google.com/group/capistrano
>
> -- Lee Hambley
>
> Twitter: @leehambley | @capistranorb
> Blog:http://lee.hambley.name/
> Working with Rails:http://is.gd/1s5W1
>
> 2009/10/28 patcoll <patc...@gmail.com>

Lee Hambley

unread,
Oct 28, 2009, 3:04:22 PM10/28/09
to capis...@googlegroups.com
And your code please? (that err output was pretty useful, need to see your implementation as per the guidelines, please)

-- Lee Hambley

patcoll

unread,
Oct 28, 2009, 3:49:41 PM10/28/09
to Capistrano
With names changed to protect the innocent:

Capfile: https://gist.github.com/7a1aec02691d15117308
Output of the _second_ time deploy:setup was run:
https://gist.github.com/9c571040fb25a42e414b

Basically you see a lot of this, as shown before:

* executing `appliance:apache:restart'
* executing "/etc/init.d/apache2 restart"

Thanks so much for looking at this.

Rafael G.

unread,
Oct 30, 2009, 9:08:31 PM10/30/09
to capis...@googlegroups.com
Hi Patcoll,

I was trying to reproduce this behaviour in a simple task but I
cann't :-(

I tried with this task:

desc "Something to check it"
task :on_error_test, :on_error => :continue, :role => :app do
run "~/foobar.sh"
end

foobar.sh is a simple script(echo message), it's stored in all hosts
except only one to make it fail.
And it show me a correct behaviour. The task is executed in all servers
fail or not fail.

The second test that I did was write a syntax error in the script
(a command not found) and one server without the script. The task was
executed in all servers likewise.

The third and last test, I added a exit 1 (I test it with an exit 2
too) in the script to return an exit value. And again I cann't reproduce
it :-(

Could you paste again your deploy.rb?

--
Rafa

Reply all
Reply to author
Forward
0 new messages