[Top][All Lists]

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

[Fab-user] The list formerly known as fab_hosts

From: s s
Subject: [Fab-user] The list formerly known as fab_hosts
Date: Tue, 5 May 2009 21:46:30 -0400

I've just updated my install to the latest version and am converting the script I'm working on to the new syntax/semantics.

Used to be you'd do:

config.fab_hosts( "", "", )

Then just write your stuff and config.fab_hosts would have each requested run() command applied.

Now, it appears that the decorator form is preferred if not required:

@hosts('a', 'b')
 def my_task():
     run('ls /var/www')
     sudo('mkdir /var/www/newsite')

1> I don't like decorating a command with the hosts against which it it is to be applied. It early-binds the function and, in a dynamic installation scenario, that just doesn't make any sense. I want to have generic operations with the hosts against which to apply those operations decided dynamically.

2> It appears that the @hosts decorator doesn't accept a list as a parameter as in:

myhosts( "", "", )

 def my_task():
     run('ls /var/www')
     sudo('mkdir /var/www/newsite')


TypeError: list objects are unhashable

Number 1 is much more important.

Number 2 is just an issue of something that shouldn't be done in the first place not supporting an obvious syntax.

We really need to handle this "hosts" issue right now before a bunch of bad code gets written to cover up the fact that using a decorator is just the wrong way to handle any part of the "on which hosts do I operate" issue.


reply via email to

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