You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When ConnectHandler is initialized without parameter 'auto_connect' all works as expected, but if I submit 'auto_connect' = False to ConnectHandler and invoke establish_connection(), then subsequent enable() fails with error:
ValueError: Failed to enter enable mode. Please ensure you pass the 'secret' argument to ConnectHandler.
Netmiko version
netmiko==4.3.0
Netmiko device_type (if relevant to the issue)
cisco_ios
Steps to Reproduce the Issue
In [26]: params
Out[26]:
{'device_type': 'cisco_ios',
'host': '10.50.51.126',
'username': 'wizard',
'password': 'sanfra',
'secret': 'cisco',
'verbose': True,
'auto_connect': False}
In [27]: dev = netmiko.ConnectHandler(**params)
In [28]: dev.establish_connection()
SSH connection established to 10.50.51.126:22
Interactive SSH session established
In [29]: dev.enable()
Error Traceback
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
Cell In[25], line 1
----> 1 dev.enable()
File ~/pylabs/venv/lib/python3.10/site-packages/netmiko/cisco_base_connection.py:26, in CiscoBaseConnection.enable(self, cmd, pattern, enable_pattern, check_state, re_flags)
17 def enable(
18 self,
19 cmd: str = "enable",
(...)
23 re_flags: int = re.IGNORECASE,
24 ) -> str:
25 """Enter enable mode."""
---> 26 return super().enable(
27 cmd=cmd,
28 pattern=pattern,
29 enable_pattern=enable_pattern,
30 check_state=check_state,
31 re_flags=re_flags,
32 )
File ~/pylabs/venv/lib/python3.10/site-packages/netmiko/base_connection.py:2050, in BaseConnection.enable(self, cmd, pattern, enable_pattern, check_state, re_flags)
2048 else:
2049 if not self.check_enable_mode():
-> 2050 raise ValueError(msg)
2052 except NetmikoTimeoutException:
2053 raise ValueError(msg)
ValueError: Failed to enter enable mode. Please ensure you pass the 'secret' argument to ConnectHandler.
Description of Issue/Question
When ConnectHandler is initialized without parameter 'auto_connect' all works as expected, but if I submit 'auto_connect' = False to ConnectHandler and invoke establish_connection(), then subsequent enable() fails with error:
ValueError: Failed to enter enable mode. Please ensure you pass the 'secret' argument to ConnectHandler.
Netmiko version
Netmiko device_type (if relevant to the issue)
Steps to Reproduce the Issue
Error Traceback
Relevant Python code
The text was updated successfully, but these errors were encountered: