fab-user
[Top][All Lists]
Advanced

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

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


From: Christian Vest Hansen
Subject: [Fab-user] Little issue with @hosts()
Date: Fri, 24 Oct 2008 00:49:52 +0200

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.




reply via email to

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