fab-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Fab-user] Passing host IP addresses to Fabric tasks from other Pyth


From: Jeff Forcier
Subject: Re: [Fab-user] Passing host IP addresses to Fabric tasks from other Python classes
Date: Tue, 27 Sep 2011 13:02:14 -0700

Hi Samuli,

2011/9/27 Samuli Seppänen <address@hidden>:

> I've been successfully using Fabric 0.9.3 on Ubuntu

Please note that Fabric 0.9.x is old and unsupported at this point in
time. All new, interesting development & features (as well as
suggested best practices) are based on the 1.x line.

If you're planning on doing any advanced Fabric-related work, I
strongly encourage you to upgrade if possible; there aren't a lot of
serious changes that need making in your client code so it's *usually*
relatively easy. See:

    
http://docs.fabfile.org/en/1.2.2/changelog.html#backwards-incompatible-changes

(The link is to the latest stable docs, but the anchor is to the
Fabric 1.0 release notes' section on backwards compat breakage.)

> However, I've been so far unable to dynamically pass on a host's
> IP-address from an external Python class to the class/file containing
> the actual Fabric tasks.

Can you elaborate on this? For one thing, if you weren't aware, Fabric
(0.9.2+) has callable roledefs that let you defer generation of host
lists to runtime:

    http://docs.fabfile.org/en/1.2.2/usage/execution.html#roles (last
para in section)

If callable roles doesn't suffice, you can use Fabric as a library and
skip a lot of its own setup mechanisms/assumptions. Library use is
deceptively simple:

    http://docs.fabfile.org/en/1.2.2/usage/library.html

So taking your "external" list of IPs and transforming them into some
form of "set env.host_string, call functions that use API commands"
*should* be pretty workable unless there's mitigating circumstances.

Re: threading: Fabric 1.3 should be out this week and contains a new
parallel execution mode leveraging multiprocessing. It might be worth
looking at in case you can find a way to shoehorn your needs into that
execution model. (FWIW, it's heavily task-based and 'fab'-based right
now, but even so.)

Hope that helps,
Jeff

-- 
Jeff Forcier
Unix sysadmin; Python/Ruby engineer
http://bitprophet.org



reply via email to

[Prev in Thread] Current Thread [Next in Thread]