Skip to content

Commit

Permalink
Merge pull request #358 from alsigna/main
Browse files Browse the repository at this point in the history
add plus sign to prompt
  • Loading branch information
carlmontanari authored Nov 15, 2024
2 parents bca7e06 + f81301b commit 638aa68
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 2 additions & 2 deletions scrapli/driver/core/arista_eos/base_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
),
"configuration": (
PrivilegeLevel(
pattern=r"^[\w.\-@()/: ]{1,63}\(config[\w.\-@/:]{0,63}\)#\s?$",
pattern=r"^[\w.\-@()/: ]{1,63}\(config[\w.\-@/:+]{0,63}\)#\s?$",
name="configuration",
previous_priv="privilege_exec",
deescalate="end",
Expand Down Expand Up @@ -81,7 +81,7 @@ def _create_configuration_session(self, session_name: str) -> None:
raise ScrapliValueError(msg)
sess_prompt = re.escape(session_name[:6])
pattern = (
rf"^[a-z0-9.\-@()/: ]{{1,63}}\(config\-s\-{sess_prompt}[a-z0-9_.\-@/:]{{0,64}}\)#\s?$"
rf"^[a-z0-9.\-@()/: ]{{1,63}}\(config\-s\-{sess_prompt}[a-z0-9_.\-@/:+]{{0,64}}\)#\s?$"
)
name = session_name
config_session = PrivilegeLevel(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
("configuration", "localhost(some thing)(config)#"),
("configuration", "localhost(some thing)(config-s-tacocat)#"),
("configuration", "eos_switch(config-s-scrapl-qos-profile-CORE-EGRESS-QUEUING-txq-5)#"),
("configuration", "eos_switch(config-sg-tacacs+-my_group)#"),
("configuration", "eos_switch(config-s-sc-sg-tacacs+-my_group)#"),
],
ids=[
"exec",
Expand All @@ -33,6 +35,8 @@
"config_with_space",
"config_session",
"config_session_very_long_qos_profile",
"config_terminal_tacacs_plus",
"config_session_tacacs_plus",
],
)
def test_prompt_patterns(priv_pattern, sync_eos_driver):
Expand All @@ -43,7 +47,7 @@ def test_prompt_patterns(priv_pattern, sync_eos_driver):

assert match

if "config-s" in prompt:
if "config-s-" in prompt:
# we will match by the pattern but the `not_contains` will mean that we should end up
# with 0 matches
with pytest.raises(ScrapliPrivilegeError):
Expand Down

0 comments on commit 638aa68

Please sign in to comment.