fab-user
[Top][All Lists]
Advanced

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

Re: [Fab-user] Automating remote interactive shell


From: Jeff Forcier
Subject: Re: [Fab-user] Automating remote interactive shell
Date: Mon, 13 Mar 2017 09:13:53 -0700

Hi Claudius,

First, there is a very basic responder functionality currently implemented, the 'env.prompts' setting:

    http://docs.fabfile.org/en/1.13/usage/env.html#prompts

If I had to guess, I'd guess it's too simple for a "fully automatic" interaction with a serial console, but it's worth trying if you haven't already.

Second, stronger expect-like behavior is on the roadmap; version 2 (alpha out very soon!) is built on the Invoke library, which has its own "2.0" rewrite of the above feature, as 'watchers':

    http://docs.pyinvoke.org/en/latest/concepts/watchers.html
    http://docs.pyinvoke.org/en/latest/api/watchers.html#invoke.watchers.StreamWatcher

I haven't needed anything more complex yet than the sudo-oriented FailingResponder yet, but as you can see from the generic StreamWatcher class, the intent is to allow for pretty much any "examine output streams, yield responses" use case (and for users to write their own instead of being limited to what's in core; though of course any generally useful patches are likely to be accepted.)

The specifics may yet change (e.g. attempting to submit deltas of the output streams instead of the full captured text) but the overall concept of stateful per-thread watcher instances seems likely to stick.

Best,
Jeff

On Mon, Mar 13, 2017 at 7:24 AM, Claudius Heine <address@hidden> wrote:
Hi everyone,

I am currently looking for something that automates some embedded Linux
development steps on a remote build server and fabric might just be the
right tool for this.

But there is one issue where I would like your thoughts on. One part of
developing embedded Linux systems is connecting to the system via a
serial terminal in order to input some commands and read their output.

AFAIK their is currently no real solution to automate interactive
programs in fabric. There is the 'open_shell' command, but that just
gives the control to the user.

I could imagine that this functionality could be implemented in fabric
using a context manager. This implementation should then wrap around
_run_command and _execute in order to provide a compatible experience.
And the context manager provides the necessary settings (shell command,
shell prompt, shell exit sequence, ... and how the exit codes of the
programs can queried, etc.). There should also be a much simpler API
similar to pexpect that is used by the _run_command and _execute wrapper
for these higher functionality.

Is such functionality on the roadmap or do you know about something that
already exists outside of fabric that solves these issues?

Thanks and have a nice day,
Claudius

--
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-54 Fax: (+49)-8142-66989-80 Email: address@hidden

           PGP key: 6FF2 E59F 00C6 BC28 31D8 64C1 1173 CB19 9808 B153
                             Keyserver: hkp://pool.sks-keyservers.net


_______________________________________________
Fab-user mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/fab-user




--
Jeff Forcier
Unix sysadmin; Python engineer
http://bitprophet.org

reply via email to

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