See the following

http://docs.fabfile.org/0.9.1/usage/execution.html

env.hosts most be set outside that function. It is so you can have
different environment settings.. think dev/staging/production.

So you could do

fab prod doit

or

fab dev doit

So you can set different hosts in

def prod():

and

def dev():

Or you can set your env outside the function


env.hosts = []
env.user = ""

def doit():
    run("ls")

On Mon, Aug 30, 2010 at 7:43 AM, John Keyes <[email protected]> wrote:
> I ran the following command using Fabric 0.9.1:
>
>    def doit():
>        env.user = 'keyes'
>        env.hosts = ['example.com']
>        run('ls')
>
> and got the following output:
>
>    No hosts found. Please specify (single) host string for connection:
>
> I changed the command to:
>
>    def doit():
>        env.user = 'keyes'
>        env.host_string = 'example.com'
>        run('ls')
>
> and the directory listing was printed to the console.
>
> The documentation always refers to the env.hosts setting but I cannot
> get that to work. Have I missed something?
>
> Thanks,
> -John
>
> _______________________________________________
> Fab-user mailing list
> [email protected]
> http://lists.nongnu.org/mailman/listinfo/fab-user
>

_______________________________________________
Fab-user mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/fab-user

Reply via email to