fab-user
[Top][All Lists]
Advanced

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

Re: [Fab-user] issue with env.roledefs callable


From: Brandon Whaley
Subject: Re: [Fab-user] issue with env.roledefs callable
Date: Tue, 05 Jan 2016 07:42:14 +0000

You're executing mycallable in your env.roledefs definition.  Remove the "()" from the end and it should work as advertised.

On Mon, Jan 4, 2016 at 10:01 PM James Litton <address@hidden> wrote:
I’m having an issue with using callables for env.roledefs. The documentation suggests that they will only be called when executing a task that uses the role:
In addition to list/iterable object types, the values in env.roledefs (or value of hosts key in dict style definition) may be callables, and will thus be called when looked up when tasks are run instead of at module load time. (For example, you could connect to remote servers to obtain role definitions, and not worry about causing delays at fabfile load time when calling e.g. fab --list.)

This does not appear to be the case from the following simple example also I could not find a corresponding bug ticket, please let me know if one already exists:
from fabric.api import *

def mycallable():
print "called"
return ["x.example.com"]

env.roledefs = {
"test": mycallable()
}

@task
def mytask():
print "Mytask called on %s" % env.roles


$ fab --list fabfile.py
called
Available commands:

    Mytask

$ fab --version
Fabric 1.10.2
Paramiko 1.16.0

Thank you for your help,
 James Litton
 address@hidden
_______________________________________________
Fab-user mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/fab-user

reply via email to

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