[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Fab-user] spliting fabfile into hosts and functions
From: |
Jeff Forcier |
Subject: |
Re: [Fab-user] spliting fabfile into hosts and functions |
Date: |
Fri, 14 Aug 2009 13:05:48 -0400 |
User-agent: |
Mutt/1.5.17+20080114 (2008-01-14) |
Hi Thomas,
Right now there's no specific best practices -- Fabric tries hard to be "just
Python", meaning that you can do anything you might normally do with Python
code. So if you have some code that somehow generates your host list, you could
stick that in e.g. get_hosts.py, then in your fabfile do "from get_hosts import
host_list" or whatnot.
In my case I keep my "fabfile" as a Python package (the master Git branch can
load packages as well as modules now) and then all the auxiliary code of this
nature lives inside the package and is imported as necessary into __init__.py.
This approach is just a slightly neater approach to the former and isn't
required, of course.
Hopefully others will have extra ideas as well -- but again, it's just Python,
so either use your pre-existing Python best practices, or look around for info
on same.
Best,
Jeff
On Fri, Aug 14, 2009 at 06:48:57PM +0200, Thomas Bikeev wrote:
> Hello everybody,
>
> what would be the best practice to integrate or include a separate .py
> file that lists my server groups.
>
> (I would like to reuse my functions that are stored in fabfile, but also
> make it consume definitions of groups defining env.hosts that are
> regenerated quite often).
>
> Cheers, Thomas
>
>
> _______________________________________________
> Fab-user mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/fab-user