fgimian / paramiko-expect

A Python expect-like extension for the Paramiko SSH library which also supports tailing logs.
MIT License
204 stars 78 forks source link

Use more lines to check for prompt at the end of the output #76

Closed sriramkannan95 closed 2 years ago

sriramkannan95 commented 2 years ago

In our project our Bash prompt is modded to look similar to ksh like:

hostname:/current/directory $

So the prompt makes up last two lines. This enhancement will allow more than just the last line while looking for the prompt.

sriramkannan95 commented 2 years ago

@fgimian @fruch

Can you please review the changes, I have tested them with my current networking infra with bash and ksh

fruch commented 2 years ago

I'm kind of blind without the tests, let me see when I'll time to fix them.

fgimian commented 2 years ago

@fgimian @fruch

Can you please review the changes, I have tested them with my current networking infra with bash and ksh

While I wrote this library, I have not used it in years so I'm not really the primary maintainer anymore. @fruch thanks heaps for helping out.

Cheers Fotis

sriramkannan95 commented 2 years ago

I'm kind of blind without the tests, let me see when I'll time to fix them.

@fruch I am able to run the tests locally (I had to modify the prompt to prompt = ".~ #.", not sure if this is required in just my machine). Will attempt to fix the automated tests

---------- coverage: platform darwin, python 3.9.7-final-0 ----------- Name Stmts Miss Cover Missing

/opt/homebrew/lib/python3.9/site-packages/paramiko_expect.py 152 3 98% 181, 235, 243

TOTAL 152 3 98%

=============================================================== 16 passed, 1 warning in 22.54s ===============================================================

https://privatebin.at/?0939064d8e715337#GydABc8RPznWM4G5dr88EZHpuNiy1RPnLKDWJhJfxqNu