2. What you're connecting to (vendor, platform, version)
Cisco IOS-XE 17.3.1
3. Anything else relevant
n/a
**Expected behavior**
Regular expression should be updated, so the script doesn't crash.
**Stack Trace**
Traceback (most recent call last):
File "/home/dmfigol/projects/network-programmability-stream/scrapli-apps/.venv/lib/python3.8/site-packages/scrapli/transport/plugins/ssh2/transport.py", line 256, in read
_, buf = self.session_channel.read(65535)
File "ssh2/channel.pyx", line 116, in ssh2.channel.Channel.read
File "ssh2/channel.pyx", line 144, in ssh2.channel.Channel.read_ex
File "ssh2/utils.pyx", line 148, in ssh2.utils.handle_error_codes
ssh2.exceptions.Timeout
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "scrapli-cfg.py", line 30, in
cfg_conn.load_config(config=rendered_config, replace=True)
File "/home/dmfigol/projects/network-programmability-stream/scrapli-apps/.venv/lib/python3.8/site-packages/scrapli_cfg/platform/core/cisco_iosxe/sync_platform.py", line 203, in load_config
config_result = self.conn.send_config(config=config, privilege_level="tclsh")
File "/home/dmfigol/projects/network-programmability-stream/scrapli-apps/.venv/lib/python3.8/site-packages/scrapli/driver/network/sync_driver.py", line 536, in send_config
multi_response = self.send_configs(
File "/home/dmfigol/projects/network-programmability-stream/scrapli-apps/.venv/lib/python3.8/site-packages/scrapli/driver/network/sync_driver.py", line 477, in send_configs
responses = super().send_commands(
File "/home/dmfigol/projects/network-programmability-stream/scrapli-apps/.venv/lib/python3.8/site-packages/scrapli/driver/generic/sync_driver.py", line 208, in send_commands
response = self._send_command(
File "/home/dmfigol/projects/network-programmability-stream/scrapli-apps/.venv/lib/python3.8/site-packages/scrapli/decorators.py", line 408, in decorate
result = wrapped_func(*args, *kwargs)
File "/home/dmfigol/projects/network-programmability-stream/scrapli-apps/.venv/lib/python3.8/site-packages/scrapli/driver/generic/sync_driver.py", line 131, in _send_command
raw_response, processed_response = self.channel.send_input(
File "/home/dmfigol/projects/network-programmability-stream/scrapli-apps/.venv/lib/python3.8/site-packages/scrapli/decorators.py", line 284, in decorate
return wrapped_func(args, **kwargs)
File "/home/dmfigol/projects/network-programmability-stream/scrapli-apps/.venv/lib/python3.8/site-packages/scrapli/channel/sync_channel.py", line 440, in send_input
buf += self._read_until_prompt()
File "/home/dmfigol/projects/network-programmability-stream/scrapli-apps/.venv/lib/python3.8/site-packages/scrapli/channel/sync_channel.py", line 131, in _read_until_prompt
buf += self.read()
File "/home/dmfigol/projects/network-programmability-stream/scrapli-apps/.venv/lib/python3.8/site-packages/scrapli/channel/syncchannel.py", line 68, in read
buf = self.transport.read()
File "/home/dmfigol/projects/network-programmability-stream/scrapli-apps/.venv/lib/python3.8/site-packages/scrapli/transport/plugins/ssh2/transport.py", line 256, in read
, buf = self.session_channel.read(65535)
File "/home/dmfigol/projects/network-programmability-stream/scrapli-apps/.venv/lib/python3.8/site-packages/scrapli/decorators.py", line 354, in _signal_raise_exception
self._handle_timeout()
File "/home/dmfigol/projects/network-programmability-stream/scrapli-apps/.venv/lib/python3.8/site-packages/scrapli/decorators.py", line 311, in _handle_timeout
raise ScrapliTimeout(self.message)
scrapli.exceptions.ScrapliTimeout: timed out sending input to device
**OS (please complete the following information):**
- OS: [e.g. Ubuntu, MacOS, etc. - Note scrapli is *not* thoroughly tested on Windows and some/many things will not
be supported] Ubuntu 20.04
- scrapli version: 2021.1.30
**Additional context**
Regexp fix: https://regex101.com/r/QdYnNu/1 (also cleaned it up to make it more concise)
`^([\w.\-@\/+>:]+\(tcl\)[>#]|\+>)$`
Describe the bug Regular expression for tclsh on IOS-XE fails to capture the prompt, to be more specific:
+>(tcl)#
To Reproduce Steps to reproduce the behavior:
with open("config", "r") as f: my_config = f.read()
device = { "host": "192.168.152.101", "auth_username": "cisco", "auth_password": "cisco", "auth_strict_key": False, "platform": "cisco_iosxe" } conn = Scrapli(**device) cfg_conn = ScrapliCfg(conn=conn) cfg_conn.open() load_result = cfg_conn.load_config(config=my_config, replace=True) print(load_result)
Traceback (most recent call last): File "/home/dmfigol/projects/network-programmability-stream/scrapli-apps/.venv/lib/python3.8/site-packages/scrapli/transport/plugins/ssh2/transport.py", line 256, in read _, buf = self.session_channel.read(65535) File "ssh2/channel.pyx", line 116, in ssh2.channel.Channel.read File "ssh2/channel.pyx", line 144, in ssh2.channel.Channel.read_ex File "ssh2/utils.pyx", line 148, in ssh2.utils.handle_error_codes ssh2.exceptions.Timeout
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "scrapli-cfg.py", line 30, in
cfg_conn.load_config(config=rendered_config, replace=True)
File "/home/dmfigol/projects/network-programmability-stream/scrapli-apps/.venv/lib/python3.8/site-packages/scrapli_cfg/platform/core/cisco_iosxe/sync_platform.py", line 203, in load_config
config_result = self.conn.send_config(config=config, privilege_level="tclsh")
File "/home/dmfigol/projects/network-programmability-stream/scrapli-apps/.venv/lib/python3.8/site-packages/scrapli/driver/network/sync_driver.py", line 536, in send_config
multi_response = self.send_configs(
File "/home/dmfigol/projects/network-programmability-stream/scrapli-apps/.venv/lib/python3.8/site-packages/scrapli/driver/network/sync_driver.py", line 477, in send_configs
responses = super().send_commands(
File "/home/dmfigol/projects/network-programmability-stream/scrapli-apps/.venv/lib/python3.8/site-packages/scrapli/driver/generic/sync_driver.py", line 208, in send_commands
response = self._send_command(
File "/home/dmfigol/projects/network-programmability-stream/scrapli-apps/.venv/lib/python3.8/site-packages/scrapli/decorators.py", line 408, in decorate
result = wrapped_func(*args, *kwargs)
File "/home/dmfigol/projects/network-programmability-stream/scrapli-apps/.venv/lib/python3.8/site-packages/scrapli/driver/generic/sync_driver.py", line 131, in _send_command
raw_response, processed_response = self.channel.send_input(
File "/home/dmfigol/projects/network-programmability-stream/scrapli-apps/.venv/lib/python3.8/site-packages/scrapli/decorators.py", line 284, in decorate
return wrapped_func(args, **kwargs)
File "/home/dmfigol/projects/network-programmability-stream/scrapli-apps/.venv/lib/python3.8/site-packages/scrapli/channel/sync_channel.py", line 440, in send_input
buf += self._read_until_prompt()
File "/home/dmfigol/projects/network-programmability-stream/scrapli-apps/.venv/lib/python3.8/site-packages/scrapli/channel/sync_channel.py", line 131, in _read_until_prompt
buf += self.read()
File "/home/dmfigol/projects/network-programmability-stream/scrapli-apps/.venv/lib/python3.8/site-packages/scrapli/channel/syncchannel.py", line 68, in read
buf = self.transport.read()
File "/home/dmfigol/projects/network-programmability-stream/scrapli-apps/.venv/lib/python3.8/site-packages/scrapli/transport/plugins/ssh2/transport.py", line 256, in read
, buf = self.session_channel.read(65535)
File "/home/dmfigol/projects/network-programmability-stream/scrapli-apps/.venv/lib/python3.8/site-packages/scrapli/decorators.py", line 354, in _signal_raise_exception
self._handle_timeout()
File "/home/dmfigol/projects/network-programmability-stream/scrapli-apps/.venv/lib/python3.8/site-packages/scrapli/decorators.py", line 311, in _handle_timeout
raise ScrapliTimeout(self.message)
scrapli.exceptions.ScrapliTimeout: timed out sending input to device