diff --git a/changelogs/fragments/758_fix_nxos_user.yaml b/changelogs/fragments/758_fix_nxos_user.yaml new file mode 100644 index 000000000..84e28f704 --- /dev/null +++ b/changelogs/fragments/758_fix_nxos_user.yaml @@ -0,0 +1,3 @@ +--- +bugfixes: + - nxos_user - fix Salt (6->8 as supported by Cisco NX-OS) chars diff --git a/plugins/modules/nxos_user.py b/plugins/modules/nxos_user.py index d3e847359..93d52d213 100644 --- a/plugins/modules/nxos_user.py +++ b/plugins/modules/nxos_user.py @@ -473,7 +473,7 @@ def main(): # check if provided hashed password is infact a hash if module.params["hashed_password"] is not None: - if not re.match(r"^\$5\$......\$.*$", module.params["hashed_password"]): + if not re.match(r"^\$5\$........\$.*$", module.params["hashed_password"]): module.fail_json(msg="Provided hash is not valid") if commands: diff --git a/tests/unit/modules/network/nxos/test_nxos_user.py b/tests/unit/modules/network/nxos/test_nxos_user.py index ba0d43756..773e8ca2a 100644 --- a/tests/unit/modules/network/nxos/test_nxos_user.py +++ b/tests/unit/modules/network/nxos/test_nxos_user.py @@ -106,13 +106,13 @@ def test_nxos_hashed_password(self): set_module_args( dict( name="ansible", - hashed_password="$5$JFHICC$u.zXRUgprAkkYLiEns8VrhsNEIOj7FzVrn67tuJdtKB", + hashed_password="$5$VVJFHICC$u.zXRUgprAkkYLiEns8VrhsNEIOj7FzVrn67tuJdtKB", ), ) self.execute_module( changed=True, commands=[ "username ansible", - "username ansible password 5 $5$JFHICC$u.zXRUgprAkkYLiEns8VrhsNEIOj7FzVrn67tuJdtKB", + "username ansible password 5 $5$VVJFHICC$u.zXRUgprAkkYLiEns8VrhsNEIOj7FzVrn67tuJdtKB", ], )