Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example Bash script not working #416

Open
SaneiSaya opened this issue Apr 11, 2024 · 0 comments
Open

Example Bash script not working #416

SaneiSaya opened this issue Apr 11, 2024 · 0 comments

Comments

@SaneiSaya
Copy link

I tried running the example bash script and it gives this error:

result | : | Traceback (most recent call last):  File \"/eNMS/eNMS/runner.py\", line 541, in run_service_job    results = self.service.job(self, *args)  File \"/eNMS/eNMS/models/services/unix/unix_shell_script.py\", line 44, in job    output = netmiko_connection.send_command(  File \"/usr/local/lib/python3.9/site-packages/netmiko/base_connection.py\", line 110, in wrapper_decorator    return_val = func(self, *args, **kwargs)  File \"/usr/local/lib/python3.9/site-packages/netmiko/utilities.py\", line 595, in wrapper_decorator    return func(self, *args, **kwargs)  File \"/usr/local/lib/python3.9/site-packages/netmiko/base_connection.py\", line 1774, in send_command    new_data = self.command_echo_read(cmd=cmd, read_timeout=10)  File \"/usr/local/lib/python3.9/site-packages/netmiko/base_connection.py\", line 1484, in command_echo_read    new_data = self.read_until_pattern(  File \"/usr/local/lib/python3.9/site-packages/netmiko/base_connection.py\", line 746, in read_until_pattern    raise ReadTimeout(msg)netmiko.exceptions.ReadTimeout: Pattern not detected: 'echo\\\\ \\'\\\\#!/bin/bash\\\\\\r\\\\\\\\\\\r\\\\\\\\\#\\\\ The\\\\ following\\\\ example\\\\ shell\\\\ script\\\\ returns\\\\ 0\\\\ for\\\\ success;\\\\ non\\\\-zero\\\\ for\\\\ failure\\\\\\r\\\\\directory_contents=\\\\$\\\\(ls\\\\ \\\\-al\\\\ /root\\\\)\\\\ \\\\ \\\\#\\\\ Needs\\\\ privileged\\\\ mode\\\\\\r\\\\\return_code=\\\\$\\\\?\\\\\\r\\\\\if\\\\ \\\\[\\\\ \\\\$return_code\\\\ \\\\-ne\\\\ 0\\\\ \\\\];\\\\ then\\\\\\r\\\\\\\\\ \\\\ \\\\ \\\\ exit\\\\ \\\\$return_code\\\\ \\\\ \\\\#\\\\ Indicating\\\\ Failure\\\\\\r\\\\\else\\\\\\r\\\\\\\\\ \\\\ \\\\ \\\\ echo\\\\ \\\\-e\\\\ \"\\\\$directory_contents\"\\\\\\r\\\\\\\\\ \\\\ \\\\ \\\\ exit\\\\ 0\\\\ \\\\ \\\\#\\\\ Indicating\\\\ Success\\\\\\r\\\\\fi\\\\\\r\\\\\\\'\\\\ >\\\\ \\'2024\\\\-04\\\\-1119:23:04\\\\.337310\\\\.sh\\'' in output.Things you might try to fix this:1. Adjust the regex pattern to better identify the terminating string. Note, inmany situations the pattern is automatically based on the network device's prompt.2. Increase the read_timeout to a larger value.You can also look at the Netmiko session_log or debug log for more information. -- | -- | --

What is the fix for this?

@SaneiSaya SaneiSaya changed the title Bash script not working Example Bash script not working Apr 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant