-
Notifications
You must be signed in to change notification settings - Fork 36
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
napalm.netmiko_commands ignore delay_factor max_loops and except_string #60
Comments
Hi @Obus20. Thanks for pointing this out. Would you be able to apply the following patch and confirm it works well: diff --git a/salt/modules/napalm_mod.py b/salt/modules/napalm_mod.py
index fae9ecf032..b1e9c937e2 100644
--- a/salt/modules/napalm_mod.py
+++ b/salt/modules/napalm_mod.py
@@ -21,6 +21,7 @@ from salt.utils.napalm import proxy_napalm_wrap
from salt.ext import six
from salt.utils.decorators import depends
from salt.exceptions import CommandExecutionError
+from salt.modules.netmiko_mod import _prepare_connection
try:
from netmiko import BaseConnection
@@ -621,10 +622,10 @@ def netmiko_commands(*commands, **kwargs):
salt '*' napalm.netmiko_commands 'show version' 'show interfaces'
'''
- conn = netmiko_conn(**kwargs)
+ conn, kwargs = _prepare_connection(**kwargs)
ret = []
for cmd in commands:
- ret.append(conn.send_command(cmd))
+ ret.append(conn.send_command(cmd, **kwargs))
return ret You can, for example, download the |
Hi @mirceaulinic. Thank you for your answer. Can you please help me with that? |
Hello,
I try to update a switch via napalm.netmiko_commands. My command looks like that:
salt 'SW' napalm.netmiko_commands "archive download-sw /overwrite http://10.100.31.110/c3560cx-universalk9-tar.152-4.E7.tar" delay_factor=20 max_loops=1000 expect_string="All software images installed."
When I try that I always get back an error:
The minion function caused an exception: Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/salt/minion.py", line 1660, in _thread_return
return_data = minion_instance.executors[fname](opts, data, func, args, kwargs)
File "/usr/lib/python3/dist-packages/salt/executors/direct_call.py", line 12, in execute
return func(*args, **kwargs)
File "/usr/lib/python3/dist-packages/salt/utils/napalm.py", line 480, in func_wrapper
ret = func(*args, **kwargs)
File "/usr/lib/python3/dist-packages/salt/modules/napalm_mod.py", line 627, in netmiko_commands
ret.append(conn.send_command(cmd))
File "/usr/local/lib/python3.5/dist-packages/netmiko/base_connection.py", line 1188, in send_command
search_pattern))
OSError: Search pattern never detected in send_command_expect: SW
But when I try it on the same switch with a netmiko proxy and the command netmiko.send_command it is working correct. That is the reason why I think that the arguments delay_factor max_loops and except_string are ignored.
Can you please help me?
Thank you!
The text was updated successfully, but these errors were encountered: