Skip to content

Commit

Permalink
ios_user_global - Take in count no username question
Browse files Browse the repository at this point in the history
Currently, on IOS devices, when you enter a `no username` command, the
system request you a question to confirm the suppression.

To handle this part, I have put a "dedicated" command for the remove
part of username part to send also a y juste after the no username
command
  • Loading branch information
earendilfr committed Aug 16, 2023
1 parent fc60ee7 commit cfa0819
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ def __init__(self, lines=None, module=None):
(\s(?P<value>\S+))?
""", re.VERBOSE,
),
"remval": r"username {{ name }}\ry",
"setval": "username {{ name }}"
"{{ ' privilege ' + privilege|string if privilege is defined and 0 <= privilege|int <= 15 and privilege|int != 1 else '' }}"
"{% if 'type' in password and password.type == 'password' %}"
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/modules/network/ios/test_ios_user_global.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def test_ios_user_global_deleted(self):
)
playbook = {"config": {}}
deleted = [
"no username johndoe secret 5 $5$cAYu$0he5yPyPAbXoXo6U0fjzb4NbLLyqDRehwQU3ysKEC33",
r"no username johndoe\ry",
]
playbook["state"] = "deleted"
set_module_args(playbook)
Expand Down Expand Up @@ -178,7 +178,7 @@ def test_ios_user_global_overridden(self):
}
overridden = [
"enable secret 9 $9$q3zuC3f3vjWnWk$4BwPgPt25AUkm8Gts6aqW.NLK/90zBDnmWtOeMQqoDo",
"no username johndoe secret 5 $5$cAYu$0he5yPyPAbXoXo6U0fjzb4NbLLyqDRehwQU3ysKEC33",
r"no username johndoe\ry",
"username admin secret 9 $9$oV7t.SyAkhiemE$D7GYIpVS/IOc0c15ev/n3p4Wo509XwQpPfyL1fuC5Dg",
]
playbook["state"] = "overridden"
Expand Down

0 comments on commit cfa0819

Please sign in to comment.