fab-user
[Top][All Lists]
Advanced

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

Re: [Fab-user] How to set config when using fabric "programmatically"?


From: Heikki Toivonen
Subject: Re: [Fab-user] How to set config when using fabric "programmatically"?
Date: Thu, 05 Mar 2009 13:30:51 -0800
User-agent: Thunderbird 2.0.0.19 (X11/20090105)

Jeff Forcier wrote:
> First, set/get is now simply attribute setting/getting of a global
> 'config' object. Secondly, you can use a @hosts decorator to set a

I am sorry, I did not make my use pattern clear. I am *importing* fabric
into my own script. I am not using fab, and I don't have a fabfile.

In [1]: import fabric

In [2]: fabric.config
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)

.../<ipython console> in <module>()

AttributeError: 'module' object has no attribute 'config'

In [3]: fabric.let
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)

.../<ipython console> in <module>()

AttributeError: 'module' object has no attribute 'let'


Replacing the loop internals here:

>>    for hostname in ['host-a', 'host-b']:
>>        fabric.set(fab_hosts=[hostname], fab_user=username,
>>                   fab_password=password, fab_fail='abort')
>>        fabric.run('uname -a')

with:

            @fabric.hosts(hostname)
            def foobar():
                fabric.run('uname -a')

            foobar()

does not work either:

Traceback (most recent call last):
  File "s.py", line 15, in main
    foobar()
  File "s.py", line 13, in foobar
    fabric.run('uname -a')
  File "build/bdist.linux-x86_64/egg/fabric.py", line 163, in wrapper
KeyError: 'fab_local_mode'

-- 
  Heikki Toivonen

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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