Closed jniec-js closed 2 months ago
I think one way to solve this is to remove the escaped characters from the output: In https://github.com/ktbyers/netmiko/blob/f0041bb1a8526f054292af2174c3412931ee565e/netmiko/scp_handler.py#L173C9-L173C46
We can do something like remote_output = remote_output.strip().replace(u"\x1b[?2004l\r", u"").replace(u"\x1b[?2004h", u"")
Another option is to send bind 'set enable-bracketed-paste off'
to the file system before sending any unix commands.
HOWEVER,
This probably affects other interactions with bash/unix to remote systems, so probably best to make whatever solution generalizable to apply to all unix interactions with devices and not just this specific issue.
We should add the:
[0m[?2004l
https://github.com/ktbyers/netmiko/blob/develop/netmiko/base_connection.py#L2340
To the ANSI escape code sequences and then enable ANSI escape code stripping for the Arista driver, basically set:
self.ansi_escape_codes = True
In the Arista driver.
Thanks, I will work on a PR
Description of Issue/Question
Beginning with bash 5.1, bracketed-paste-mode is enabled by default: https://forum.endeavouros.com/t/bash-5-1-bracketed-paste-now-on-by-default/10258
This causes issues when trying to scp a file to a remote unix system using bash 5.1, as the first line is now escape characters instead of the expected header line as the source code indicates here: https://github.com/ktbyers/netmiko/blob/f0041bb1a8526f054292af2174c3412931ee565e/netmiko/scp_handler.py#L177
The actual output Netmiko sees is:
Setup
Netmiko version
Netmiko device_type (if relevant to the issue)
(Paste
device_type
between quotes below)Note: Starting in 4.32 train, Arista has upgraded the version of bash to 5.1 on their devices, so this requires a device running EOS 4.32 or higher.
Steps to Reproduce the Issue
Error Traceback
(Paste the complete traceback of the exception between quotes below)
Note, the escape characters are not printable by default, this is the actual output:
Relevant Python code
Run the below against an Arista device that is running 4.32 or higher version of code, you will get a parse failure.