-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Open
Description
When we call send_command without an expected output, Netmiko should look for the default device prompt, but it sometimes doesn't.
Example code:
pattern_files = r"Do you want to remove the above files\? \[y\/n\]"
pattern_success = r"SUCCESS: install_remove"
# Connect to the device
with ConnectHandler(**device_connect_info) as net_connect:
output = net_connect.send_command(
"install remove inactive", f"({pattern_files}|{pattern_success})"
)
if pattern_success in output:
msg = f"No unused installation files on {device.host_name} to remove."
logger.debug(msg)
else:
output = net_connect.send_command("y")
msg = f"Unused installation files have been removed from {device.host_name}."
logger.debug(msg)
logger.debug(f"Cleanup of installation files on {device.host_name} completed.")
This code causes an exception on the line:
output = net_connect.send_command("y")
The exception is:
netmiko.exceptions.ReadTimeout:
Pattern not detected: '\\[y/n\\]' in output.
It is unclear to us why Netmiko is expecting a [y/n] prompt here and not the standard device prompt.
We're on Netmiko 4.5.0
Metadata
Metadata
Assignees
Labels
No labels