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
[email protected]
http://lists.nongnu.org/mailman/listinfo/fab-user

Reply via email to