DataDog/dogapi — pull request #59 by conorbranagan (2013-08-21 21:17:53+00:00)
Title: Support @roles and @hosts in fabric

In the current fabric integration, if you use `@roles` or `@hosts` with `@notify` you will lose the hosts and roles you have defined by the time the task is running. Removing `@notify` fixes the problem, but then you can't get notifications in Datadog.

This error shows up by Fabric prompting you for a hostname with:
> "No hosts found. Please specify (single) host string for connection".

As a fix, I've changed the fabric integration so it no longer expects a `WrappedCallableTask` but instead it just expects the task function itself, getting the name from `func.__name__` and the arguments as it did before.

I tested against the examples with the new and old versions (moving the decorator) and things work as expected. I also added an additional example

(Internal case: https://datadog.desk.com/agent/case/5375)

@alq666 Can you review?