-
Notifications
You must be signed in to change notification settings - Fork 25
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
How to add device prompt using kwargs to identify the pattern? #65
Comments
What does executing this command look like in the CLI (i.e. when you execute it in the CLI)?
|
It is a juniper device config mode command. It works on the device. |
With naplm nornir as well it gives error, i have observed that juniper device config mode commands dont work. Show commands work perfectly. |
Yes, I want to see the actual CLI output so I can see why Netmiko is complaining. In other words, if you enter in this command:
Is this what you see or is the above an abbreviation that gets expanded? |
|
Okay, try doing:
Also, make sure you are using the latest released version of Netmiko. |
@robthebuilder123 Did the above command work? |
Also trying to figure out if there is a way to pass kwargs to the enable() function inside netmiko_send_command. Is there a way to enable this? I fixed it for now adding some checks in my local repo, but not sure what the best idea is to fix this if possible. |
@denialmx Can you post your code include the dictionary of arguments. It is a standard Python method so you can pass in **kwargs (as per normal). |
Hi @ktbyers I'm currently solving my issue with this code. def enable(
self,
cmd: str = "sudo -s",
pattern: str = "ssword",
enable_pattern: Optional[str] = None,
re_flags: int = re.IGNORECASE,
) -> str:
"""Attempt to become root.""" in netmiko_send_command the code I'm using is below: Basically, I look for enable_cmd, enable_pattern, and if they exist I put them in enable_kwargs. enable_kwargs = {mapped_arg: kwargs.pop(arg)
for arg, mapped_arg in {'enable_cmd': 'cmd', 'enable_pattern': 'pattern'}.items()
if arg in kwargs}
if enable:
net_connect.enable(**enable_kwargs) so far it has worked without issue to sudo into alpine linux and ubuntu on my side. Thanks |
@denialmx So you don't have any issue then? |
Hi @ktbyers, I currently don't have an issue. This code seems to work well for me in netmiko_send_command. Thanks in advance! |
@denialmx I would think this would be just in your own task outside of the plugin, but let me know if I am missing something on this (i.e. some reason that is not practical). |
while running:
==================================================================
Error recieved
=============
netmiko.exceptions.ReadTimeout:
=========================================================================
How to add device prompt using kwargs to identify the pattern?
The text was updated successfully, but these errors were encountered: