ronnix/fabtools — pull request #202 by deanmalmgren (2014-01-02 18:55:25+00:00)
Title: @vagrant_task convenience decorator

I've been really happy using fabtools as a replacement for puppet the past month. As I've been working on things, I've noticed myself consistently using a pattern similar to this, which is really redundant when you have 20+ tasks:

```python
@task
def some_task():
with vagrant_settings():
run('echo hello')
```

To simplify things, I thought I'd throw together a simple `@vagrant_task` decorator so you can just do:

```python
@vagrant_task
def some_task():
run('echo hello')
```

I have mixed feelings about the current implementation. It does not support [arguments to be passed to the `@task` decorator](http://docs.fabfile.org/en/latest/usage/tasks.html#arguments) nor does it contemplate `some_task`'s that might themselves have arguments. This does make it pretty easy to write tasks that are specifically for vagrant machines though and I thought I'd share in case others have better ideas for how to streamline the process.

What do people think? Any suggested changes?