Skip to content

Fabric returns exit code 0 on failed parallel tasks #572

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
statico opened this issue Feb 28, 2012 · 2 comments
Closed

Fabric returns exit code 0 on failed parallel tasks #572

statico opened this issue Feb 28, 2012 · 2 comments

Comments

@statico
Copy link

statico commented Feb 28, 2012

Given this fabfile.py:

from fabric.api import *

def test():
    abort('whoops')

And the command:

$ fab test -H host1,host2 && echo yes || echo no

The result is:

Fatal error: whoops

Aborting.
[host1] Executing task 'foo'
no

Makes sene. However, if I run them in parallel using the -P flag or @parallel decorator:

[host1] Executing task 'foo'
[host2] Executing task 'foo'

Fatal error: whoops

Aborting.
!!! Parallel execution exception under host 'host1':
Traceback (most recent call last):
  File "/opt/stow/python-2.7.2/lib/python2.7/site-packages/fabric/tasks.py", line 167, in inner
    result = task.run(*args, **kwargs)
  File "/opt/stow/python-2.7.2/lib/python2.7/site-packages/fabric/tasks.py", line 113, in run
    return self.wrapped(*args, **kwargs)
  File "/opt/stow/python-2.7.2/lib/python2.7/site-packages/fabric/decorators.py", line 178, in inner
    return func(*args, **kwargs)
  File "/tmp/temp.py", line 5, in foo
    abort('whoops')
  File "/opt/stow/python-2.7.2/lib/python2.7/site-packages/fabric/utils.py", line 26, in abort
    sys.exit(1)
SystemExit: 1

Fatal error: whoops

Aborting.
!!! Parallel execution exception under host 'host0':
Traceback (most recent call last):
  File "/opt/stow/python-2.7.2/lib/python2.7/site-packages/fabric/tasks.py", line 167, in inner
    result = task.run(*args, **kwargs)
  File "/opt/stow/python-2.7.2/lib/python2.7/site-packages/fabric/tasks.py", line 113, in run
    return self.wrapped(*args, **kwargs)
  File "/opt/stow/python-2.7.2/lib/python2.7/site-packages/fabric/decorators.py", line 178, in inner
    return func(*args, **kwargs)
  File "/tmp/temp.py", line 5, in foo
    abort('whoops')
  File "/opt/stow/python-2.7.2/lib/python2.7/site-packages/fabric/utils.py", line 26, in abort
    sys.exit(1)
SystemExit: 1

Done.
yes

Shouldn't fabric return non-zero if any of the subtasks failed? (I don't necessarily care about order, like issue #457)

Fabric is great, BTW. Keep up the fantastic work.

@bitprophet
Copy link
Member

Thanks for the catch! You're absolutely right. I just fixed this and pushed it to the 1.4 and master branches. If you've the will to grab an unreleased version you can check it out. Otherwise I'll probably push a bugfix series in a few days/weekish.

@statico
Copy link
Author

statico commented Feb 28, 2012

Thanks! :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants