diff --git a/fabric_remote/tasks.py b/fabric_remote/tasks.py index f234b42..a18d29b 100644 --- a/fabric_remote/tasks.py +++ b/fabric_remote/tasks.py @@ -7,10 +7,12 @@ from fabric.tasks import execute from fabric.main import load_fabfile from fabric.tasks import WrappedCallableTask -from StringIO import StringIO from . import app from .util import threadsafe_iter +class FabricException(Exception): + pass + class QueueIO(object): @@ -44,6 +46,8 @@ def _load_fabfile(self): ) # Don't prompt me bro state.env.abort_on_prompts = True + # Let us capture exceptions + state.env.abort_exception = FabricException def list_tasks(self): self._load_fabfile() @@ -61,7 +65,7 @@ def _execute(self, tasks, queue): **task.get('kwargs', {}) ) queue.put({"results": (task, results)}) - except Exception as e: + except FabricException as e: queue.put({"error": str(e)}) def run_tasks(self, tasks): diff --git a/setup.py b/setup.py index 79d02cd..8110d4f 100644 --- a/setup.py +++ b/setup.py @@ -27,7 +27,7 @@ def run_tests(self): setup( name='fabric_remote', - version='0.0.1', + version='0.0.2', long_description=__doc__, description='REST API for Fabric', url='https://github.com/kevin1024/fabric_remote/', diff --git a/tests/fixtures/fabfile.py b/tests/fixtures/fabfile.py index d866afc..8ea7cc4 100644 --- a/tests/fixtures/fabfile.py +++ b/tests/fixtures/fabfile.py @@ -12,9 +12,7 @@ def host_type(): local('echo blah') time.sleep(4) local('echo blah') - time.sleep(4) local('echo blah') - time.sleep(4) local('echo blah') env['foo'] = 'bar' return "shit worked"