carlmontanari / scrapli

Fast, flexible, sync/async, Python 3.7+ screen scraping client specifically for network devices
https://carlmontanari.github.io/scrapli/
MIT License
587 stars 62 forks source link

AsyncSSH - Screen Width Issues #338

Open AlexLardschneider opened 4 months ago

AlexLardschneider commented 4 months ago

Describe the bug

Hey Carl!

Been switching from using system transport to AsyncSSH, and I am encountering the same issue we already saw in https://github.com/scrapli/scrapli_community/issues/18. Even though I am increasing the screen-width using the CLI command on the device, it seems to be ignored since the output still contains line breaks.

It looks like this can be fixed by setting the term_size argument during asyncssh session opening (transport.py#221)

self.stdin, self.stdout, _ = await self.session.open_session(
    term_type="xterm", term_size=(256, 256), encoding=None
)

Unfortunately, currently there is no way to set this argument except patching the transport.py file manually.
Maybe we should add the possibility to add user-defined **kwargs to this open_session method, like we can for system transport?

Let me know if and how you'd like this implemented (or maybe there is already a way to fix this which I overlooked?), and I can create a PR to solve this.

To Reproduce See https://github.com/scrapli/scrapli_community/issues/18

Expected behavior See See https://github.com/scrapli/scrapli_community/issues/18

OS (please complete the following information):

carlmontanari commented 4 months ago

hey @AlexLardschneider 👋

makes sense! can we support it with the existing transport args like in here? I didnt look too closely yet but I just remember we have at least some capacity to pass arbitrary/semi-arbitrary stuff to asyncssh. if this doesn't work though we can for sure make this work in one way!

AlexLardschneider commented 4 months ago

Hey @carlmontanari, let me see what I can do.

carlmontanari commented 3 months ago

hey @AlexLardschneider did ya get this sorted ? anything we need to do here?

AlexLardschneider commented 3 months ago

Hey Carl, things are pretty hectic at the moment, but I haven't forgotten about this. I'll jump on it when I find some free time!