Skip to content

Commit

Permalink
Fix to accommodate single character prompts (#2891)
Browse files Browse the repository at this point in the history
  • Loading branch information
ktbyers committed Aug 8, 2022
1 parent 4cbd836 commit fd5dbbe
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
9 changes: 7 additions & 2 deletions netmiko/base_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -1291,8 +1291,13 @@ def set_base_prompt(

if not prompt[-1] in (pri_prompt_terminator, alt_prompt_terminator):
raise ValueError(f"Router prompt not found: {repr(prompt)}")
# Strip off trailing terminator
self.base_prompt = prompt[:-1]

# If all we have is the 'terminator' just use that :-(
if len(prompt) == 1:
self.base_prompt = prompt
else:
# Strip off trailing terminator
self.base_prompt = prompt[:-1]
return self.base_prompt

def find_prompt(
Expand Down
3 changes: 3 additions & 0 deletions tests/test_netmiko_show.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,9 @@ def test_enable_mode(net_connect, commands, expected_responses):
Catch exception for devices that don't support enable
"""
# testuser on pynetqa does not have root access
if net_connect.username == "testuser" and net_connect.host == "3.15.148.177":
assert pytest.skip()
try:
net_connect.enable()
enable_prompt = net_connect.find_prompt()
Expand Down

0 comments on commit fd5dbbe

Please sign in to comment.