fab-user
[Top][All Lists]
Advanced

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

Re: [Fab-user] Little issue with @hosts()


From: Christian Vest Hansen
Subject: Re: [Fab-user] Little issue with @hosts()
Date: Fri, 24 Oct 2008 01:05:41 +0200

On Fri, Oct 24, 2008 at 12:54 AM, Jeff Forcier <address@hidden> wrote:
> Yes, that's a semi known issue -- I've only had to use it with one-off
> commands, and I kinda knew that it wouldn't work too well when
> composing + using different host lists for each command (which strikes
> me as a bit of an edge case, but, it's important that we tackle the
> issue regardless).

I know. I don't regard it with any terrible urgency either, but just
wanted to make sure that you knew :)

> I still haven't had the time to look at Niklas'
> code -- hopefully tonight! -- so I'm not 100% sure what his does.
>
> -Jeff
>
> On Thu, Oct 23, 2008 at 6:49 PM, Christian Vest Hansen
> <address@hidden> wrote:
>> Jeff + World,
>>
>> Commands in a fabfile that are annotated with the @hosts() decorator
>> don't compose or nest terribly well. That is, we only take the
>> outer-most decorator into consideration.
>>
>> Example:
>>
>> @hosts('localhost')
>> def test_nested_remotes_part_2():
>>    "used by test_nested_remotes"
>>    run("echo 2-5 $(fab_host)")
>>
>> # this won't connect to 127.0.0.1 when called by test_nested_remotes()!
>> @hosts('localhost', '127.0.0.1')
>> def test_nested_remotes_part_4():
>>    "used by test_nested_remotes"
>>    run("echo 4-5 $(fab_host)")
>>
>> @hosts('localhost')
>> def test_nested_remotes():
>>    "Tests nesting of commands that require connections."
>>    run("echo 1-5")
>>    test_nested_remotes_part_2()
>>    run("echo 3-5")
>>    test_nested_remotes_part_4()
>>    run("echo 5-5 and done.")
>>
>> Ideally, we would detect that part_4 needs to connect and then
>> disconnect 127.0.0.1, but I don't see a way to do that while having
>> the `hosts` decorator returning the input function.
>>
>> Niklas has created his decorators with the assistance of a
>> _new_call_chain_decorator function, which I think is useful here. But
>> I'm a little tired right now and not yet that familiar with the code
>> to really say for sure (but I am inching closer and closer to merging
>> his branch).
>>
>>
>> --
>> Venlig hilsen / Kind regards,
>> Christian Vest Hansen.
>>
>>
>> _______________________________________________
>> Fab-user mailing list
>> address@hidden
>> http://lists.nongnu.org/mailman/listinfo/fab-user
>>
>



-- 
Venlig hilsen / Kind regards,
Christian Vest Hansen.




reply via email to

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