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: Jeff Forcier
Subject: Re: [Fab-user] Little issue with @hosts()
Date: Thu, 23 Oct 2008 18:54:11 -0400

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 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
>




reply via email to

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