eNMS-automation / eNMS

An enterprise-grade vendor-agnostic network automation platform.

Home Page:https://www.enms.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Example Bash script not working

SaneiSaya opened this issue · comments

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?