[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Fab-user] Calling Fabric from Python
From: |
Xavier Ordoquy |
Subject: |
Re: [Fab-user] Calling Fabric from Python |
Date: |
Sat, 18 Sep 2010 16:45:26 +0200 |
Thanks a lot Jeff.
I have probably skipped that part because I was looking for a behavior that was
nearer to the way fab works (set hosts and let the magic do the work).
The fact that you point that part in the documentation solves my issue with a
workaround - ie tasks are not working in python as they are when called from
the command line.
I'll go this way for now and look later in the code to get tasks working as
they do when they are called from the fab command line tool - I hope I'll find
the time to.
Regards,
Xavier.
Le 18 sept. 2010 à 15:41, Jeff Forcier a écrit :
> Try this:
>
> http://docs.fabfile.org/0.9.2/usage/execution.html#connections
>
> -Jeff
>
> On Sat, Sep 18, 2010 at 9:26 AM, Xavier Ordoquy <address@hidden> wrote:
>> Hi,
>>
>> Unfortunately, I have already read the documentation but might have missed
>> or didn't understood something.
>>
>> Currently, my biggest issue is:
>>
>>>>> from fabric.api import env, run
>>>>> env.user = 'root'
>>>>> env.hosts = ['whatever',]
>>>>> env.host = 'whatever'
>>>>> def test():
>> ... run('uname -a')
>> ...
>>>>> test()
>> No hosts found. Please specify (single) host string for connection:
>>
>> If I put that in a fabfile.py and run a fab test it will work.
>>
>> Regards,
>> Xavier.
>>
>> Le 18 sept. 2010 à 14:58, Jeff Forcier a écrit :
>>
>>> Hi Xavier,
>>>
>>> Make sure you read the documentation[1]; it does need more work
>>> regarding library use, but you can still get very far just by reading
>>> the usage docs, especially the one on execution.
>>>
>>> Best,
>>> Jeff
>>>
>>> [1] http://docs.fabfile.org/
>>>
>>>
>>> On Sat, Sep 18, 2010 at 7:20 AM, Xavier Ordoquy <address@hidden> wrote:
>>>> Hi,
>>>>
>>>> I have been using Fabric for some time now and I am very happy with the
>>>> help it provides for system administration.
>>>> However, I'd like to go one step furtherand couple fabric together with a
>>>> python script - ie calling fabric from my own scripts.
>>>> I'm getting a real hard time understanding how I can start tasks from my
>>>> python script, esp settings things such as hosts, users and so on.
>>>>
>>>> I didn't manage to find something on the net about using fabric from
>>>> within python.
>>>> Maybe someone has a link, a blog entry or whatever to help me getting
>>>> started ?
>>>>
>>>> Regards,
>>>> Xavier.
>>>> _______________________________________________
>>>> Fab-user mailing list
>>>> address@hidden
>>>> http://lists.nongnu.org/mailman/listinfo/fab-user
>>>>
>>>
>>>
>>>
>>> --
>>> Jeff Forcier
>>> Unix sysadmin; Python/Ruby developer
>>> http://bitprophet.org
>>
>>
>> _______________________________________________
>> Fab-user mailing list
>> address@hidden
>> http://lists.nongnu.org/mailman/listinfo/fab-user
>>
>
>
>
> --
> Jeff Forcier
> Unix sysadmin; Python/Ruby developer
> http://bitprophet.org