[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fab-user] @hosts decorator fails in python interactive session?
From: |
Matthew Wilson |
Subject: |
[Fab-user] @hosts decorator fails in python interactive session? |
Date: |
Tue, 7 Jul 2009 14:56:44 -0400 |
I'm likely doing something wrong, but I can't get the hosts decorator
to behave when I use it from within an interactive session:
>>> @hosts('jaffa.tplus1.com', 'daffodil.tplus1.com')
... def hostname():
... run('hostname')
...
>>> hostname.hosts
['jaffa.tplus1.com', 'daffodil.tplus1.com']
>>> hostname()
No hosts found. Please specify (single) host string for connection:
I can put all that same code into a fabfile.py and all is well:
$ cat fabfile.py
# vim: set expandtab ts=4 sw=4 filetype=python:
from fabric.api import hosts, run
@hosts('jaffa.tplus1.com', 'daffodil.tplus1.com')
def hostname():
run('hostname')
$ fab hostname
[daffodil.tplus1.com] run: hostname
[daffodil.tplus1.com] out: daffodil
[jaffa.tplus1.com] run: hostname
[jaffa.tplus1.com] out: jaffa.tplus1.com
Done.
Disconnecting from daffodil.tplus1.com... done.
Disconnecting from jaffa.tplus1.com... done.
--
Matthew Wilson
address@hidden
http://tplus1.com
- [Fab-user] @hosts decorator fails in python interactive session?,
Matthew Wilson <=