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: Claudius Heine
Subject: Re: [Fab-user] Automating remote interactive shell
Date: Mon, 13 Mar 2017 18:53:05 +0100

Hi Jeff,

On Mon, 2017-03-13 at 09:13 -0700, Jeff Forcier wrote:
> 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.

Hmm... Yes, I think its a bit limiting when you only have a 1:1 mapping
for prompt to input. It would be great when those sub-shells are
treated the same as the the rest of the program. So if something like
"run" or "sudo" is available in this shell, then use it, otherwise just
use something like pexpect. I would try to implement something like
shell capabilities that can be set in the shell-context. Maybe even
being able to automate the input to a python shell on the remote target
;) Not sure how useful that would be tough.

> 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.watch
> ers.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.)

Oh great, I will take a look at it.

I think that could be done generic enough to be useful for upstream.

Maybe its possible to have a class with the invoke.context.Context
methods + pexpect style ones that uses the builder pattern or similar
to create a watcher that then responds to the program output.

Cheers,
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

Attachment: signature.asc
Description: This is a digitally signed message part


reply via email to

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