How to make overridden code handle errors correctly?

12 views
Skip to first unread message

Will Platnick

unread,
May 31, 2016, 11:14:57 AM5/31/16
to Capistrano
Hello,
I have a capistrano deploy that I override a task definition in order to do some custom things, an incomplete example below. My problem is, capistrano doesn't seem to check for errors when this happens. So, in my code that does things like reload nginx, if the config is bad and it can't reload, capistrano continues on like there's no issue. How do I make capistrano pay attention to the exit codes like it normally does?

    Rake::Task["deploy:symlink:release"].clear_actions
    namespace :symlink do
        desc 'OVERRIIIIIIDE'
        task :release do
            on roles(:app), in: :sequence do
                # Make /up return a 404
                execute "touch /tmp/disabled || true"
                # Give time for ELB to fail health checks
                execute "sleep 10"
                # Wait for uWSGI to stop processing stragglers
                execute "#{release_path}/lib/wait_uwsgi.sh"


Lee Hambley

unread,
May 31, 2016, 11:26:33 AM5/31/16
to Capistrano
I'm not seeing anything here that does anything that can return an exit status other than 0 (not knowing what `wait_uwsgi.sh` does).

In principle if an `execute()` exits with a non-zero status, it'll raise - see the docs around the `test()` function, it's analog which tolerates errors https://github.com/capistrano/sshkit/blob/master/EXAMPLES.md#make-a-test-or-run-a-command-which-may-fail-without-raising-an-error

--
You received this message because you are subscribed to the Google Groups "Capistrano" group.
To unsubscribe from this group and stop receiving emails from it, send an email to capistrano+...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/capistrano/cc78c368-c467-489b-a6f9-3d422cfd0c5d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Will Platnick

unread,
Jun 8, 2016, 9:44:56 AM6/8/16
to Capistrano
I didn't give every line of code, just an example of what I'm doing. In the overriden code, exit codes do not matter. I can run the command 'false' which returns error code 1, and execution still keeps going. Everywhere else, it raises fine. For some reason, errors are not raising in overridden functions.

Lee Hambley

unread,
Jun 8, 2016, 9:50:15 AM6/8/16
to Capistrano
That's probably a problem then Will, perhaps you could open an issue on Github and we'll look into it?
Reply all
Reply to author
Forward
0 new messages