diff options
| author | Mason Elmore <masonelmore@users.noreply.github.com> | 2026-09-11 04:32:37 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-09-11 12:32:37 +0300 |
| commit | 25635b0560863eb4a5b34434bb34dfd7c43d77f9 (patch) | |
| tree | 2972ea1315b42576ce9ca85fb20e54fa074c7d55 /tests | |
| parent | 497022e13c372ed68afe49aeafca66285e2f8001 (diff) | |
| download | vyos.vyos-25635b0560863eb4a5b34434bb34dfd7c43d77f9.tar.gz vyos.vyos-25635b0560863eb4a5b34434bb34dfd7c43d77f9.zip | |
T9251: accept OpenSSH sk-* key types in vyos_user (#500)
* T9251: accept OpenSSH sk-* key types in vyos_user
VyOS has accepted sk-ecdsa-sha2-nistp256@openssh.com and
sk-ssh-ed25519@openssh.com since T4750, but the module's choices
list was never updated, so a playbook using a security key fails
argspec validation while the equivalent CLI commands succeed.
---------
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Co-authored-by: omnom62 <omnom62@outlook.com>
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/unit/modules/network/vyos/test_vyos_user.py | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/unit/modules/network/vyos/test_vyos_user.py b/tests/unit/modules/network/vyos/test_vyos_user.py index 0e60f07e..27ab1f38 100644 --- a/tests/unit/modules/network/vyos/test_vyos_user.py +++ b/tests/unit/modules/network/vyos/test_vyos_user.py @@ -18,6 +18,7 @@ # Make coding more python3-ish from __future__ import absolute_import, division, print_function + __metaclass__ = type from unittest.mock import patch @@ -170,6 +171,39 @@ class TestVyosUserModule(TestVyosModule): ], ) + def test_vyos_user_set_security_keys(self): + set_module_args( + dict( + name="ansible", + public_keys=[ + dict( + name="ecdsa@host", + key="AAAAInNrLWVjZHNhLXNoYTItbmlzdHAyNTZAb3BlbnNzaC5jb20AAAAIbmlzdHAyNTY", + type="sk-ecdsa-sha2-nistp256@openssh.com", + ), + dict( + name="ed25519@host", + key="AAAAGnNrLXNzaC1lZDI1NTE5QG9wZW5zc2guY29tAAAAIFIR0jrMvBdmvTJNY5EDhOD", + type="sk-ssh-ed25519@openssh.com", + ), + ], + ), + ) + result = self.execute_module(changed=True) + self.assertEqual( + result["commands"], + [ + "set system login user ansible authentication public-keys " + "ecdsa@host key 'AAAAInNrLWVjZHNhLXNoYTItbmlzdHAyNTZAb3BlbnNzaC5jb20AAAAIbmlzdHAyNTY'", + "set system login user ansible authentication public-keys ecdsa@host " + "type 'sk-ecdsa-sha2-nistp256@openssh.com'", + "set system login user ansible authentication public-keys ed25519@host " + "key 'AAAAGnNrLXNzaC1lZDI1NTE5QG9wZW5zc2guY29tAAAAIFIR0jrMvBdmvTJNY5EDhOD'", + "set system login user ansible authentication public-keys ed25519@host " + "type 'sk-ssh-ed25519@openssh.com'", + ], + ) + def test_vyos_user_set_ssh_key_idempotent(self): set_module_args( dict( |
