fab-user
[Top][All Lists]
Advanced

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

Re: [Fab-user] Shell Command?


From: Jeff Forcier
Subject: Re: [Fab-user] Shell Command?
Date: Mon, 25 May 2009 20:03:09 -0400

On Mon, May 25, 2009 at 7:32 PM, Jorge Vargas <address@hidden> wrote:

> oh really? so there is no threaded model yet? For some reason I though
> that was the default. it was in 0.1?

Per-host threading never actually worked; Christian had some code
towards that goal but as far as I'm aware it was never fully
operational.

The main difference between 0.1 and friends, and 0.9, was that Fabric
ran your fabfile function once only, with run() and sudo() iterating
over the host list each time they were called. Nowadays the entire
function runs once per host in the host list (and thus run/sudo/etc
run on a single host at a time), which allows a more natural
construction of the code in your fabfile.

We do plan on solving the parallelism problem at some point, however,
whether that's with actual threads, or some other concurrency solution
like Twisted, Kamaelia or whatnot. In such a scenario, your functions
are still run once per host, but instead of iterating serially over
the host list when doing so, they'd all run at the same time.

> well I don't know a lot of paramiko, so I really don't know I guess I
> could experiment with it a little.

Honestly I think the best way to do a Fabric shell would simply be to
just use IPython, which is quite possible right now, and probably some
extra code to make managing hosts and so forth a little easier.

Here's me using Fabric interactively right now (without any
aforementioned shell-specific extras, as they don't exist yet :D):

    (fabric)address@hidden:~/Documents/Code/fabric $ ipython

    In [1]: from fabric.api import *

    In [2]: env.host_string = 'localhost'

    In [3]: with settings(warn_only=True):
       ...:     run('blah')
       ...:
       ...:
    [localhost] run: blah
    [localhost] err: /bin/bash: blah: command not found

    Warning: run() encountered an error (return code 127) while executing 'blah'

    Out[3]: ''

    In [4]: run('more blah')
    [localhost] run: more blah
    [localhost] err: blah: No such file or directory

    Fatal error: run() encountered an error (return code 1) while
executing 'more blah'

    Aborting.
    ---------------------------------------------------------------------------
    SystemExit                                Traceback (most recent call last)
    ...


As you can see, I called run() once (with warn-only turned on) and was
able to continue executing as normal. With warn_only not turned on,
SystemExit is raised (though IPython actually has builtin options such
that you are NOT kicked out of the interpreter when this happens,
which is nice.)

So any "shell" functionality is, I'd imagine, simply going to be
streamlining that experience. Again, however, this is not set in
stone, and I'll be soliciting use cases when I get around to
implementing anything.

-Jeff

>
>> Best,
>> Jeff
>>
>> On Mon, May 25, 2009 at 7:01 PM, Jorge Vargas <address@hidden> wrote:
>>> Hello,
>>>
>>> Are they any plans (or is it even possible) to provide a interactive
>>> shell over paramiko?
>>>
>>> I'm interested in two use cases
>>> 1- fallback to shell if the command fails
>>> 2- automate half of a process, let the user poke around, and possibly
>>> run another set of automatic commands.
>>>
>>> And example of the second will be "get me a psql command line on my
>>> database server X"
>>>
>>> I'm not sure how this will work with multiple hosts, I guess it could
>>> be turned off or simply pile them up.
>>>
>>>
>>> _______________________________________________
>>> Fab-user mailing list
>>> address@hidden
>>> http://lists.nongnu.org/mailman/listinfo/fab-user
>>>
>>
>




reply via email to

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