ronnix/fabtools — pull request #31 by madjar (2012-09-28 13:53:45+00:00)
Title: Distro-specific implementation

Hello

This work is not merge ready for now, but I would like your opinion on the way I plan to do it.

First of all, I added two variables that the user should edit : `fabtools.distros`, which is a host/distro dictionary and `fabtools.default_distro`, which is the distro that should be used if not distro is specified for the host.

Then, I have a `distro` decorator which is backed by some kind of multimethod : decorate a function with `@distro("deb")`, and it will only be run if the host is running debian (according to `fabtools.distros`). The documentation of the first defined function is kept.

Doing it this enabled me to write a simple `check_distro_support` function that lists all the function not supported that do not support a given distro.

As an example of usage, I've made `fabtools.service` compatible with arch.

I think I should add some distro recognition for this to be convenient.

So, do you like this ? Anything you would prefer to be different ? Can I start a adding full support for arch based in this ?