Fix ios_user issue CP in 2.6 (#45175)
* Fix ios_user issues (#44904)
* Fix ios_user issues
* Modify regex and fix unittests
(cherry picked from commit 0f268e70a1
)
* Added changelog
This commit is contained in:
parent
9acfbeed7b
commit
0c367e77f0
2 changed files with 4 additions and 7 deletions
3
changelogs/fragments/fix_ios_user.yaml
Normal file
3
changelogs/fragments/fix_ios_user.yaml
Normal file
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
bugfixes:
|
||||
- ios_user - fix unable to delete user admin issue (https://github.com/ansible/ansible/pull/44904)
|
|
@ -241,7 +241,7 @@ def parse_privilege(data):
|
|||
def map_config_to_obj(module):
|
||||
data = get_config(module, flags=['| section username'])
|
||||
|
||||
match = re.findall(r'^username (\S+)', data, re.M)
|
||||
match = re.findall(r'(?:^(?:u|\s{2}u))sername (\S+)', data, re.M)
|
||||
if not match:
|
||||
return list()
|
||||
|
||||
|
@ -392,12 +392,6 @@ def main():
|
|||
|
||||
result['commands'] = commands
|
||||
|
||||
# the ios cli prevents this by rule so capture it and display
|
||||
# a nice failure message
|
||||
for cmd in commands:
|
||||
if 'no username admin' in cmd:
|
||||
module.fail_json(msg='cannot delete the `admin` account')
|
||||
|
||||
if commands:
|
||||
if not module.check_mode:
|
||||
load_config(module, commands)
|
||||
|
|
Loading…
Reference in a new issue