From 16e6f21de8e90833e2284aeab6cd39d2e1482155 Mon Sep 17 00:00:00 2001 From: gideon-kuijt-northwave Date: Tue, 7 Apr 2026 13:46:41 +0200 Subject: T8205 Ensure the vyos_user module works when user properties are defined in… (#445) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Ensure the vyos_user module works when user properties are defined in aggregate Ensure the vyos_user module works when user properties are defined in aggregate. Previously the value variable is not filled when a property is configured as a property of a user. This gives a python error when the value variable is called. * Add unit test for aggregate vyos_user module * Create vyos_user_aggregate_fix.yml Create changelog for vyos_user aggregate bugfix * Rename vyos_user_aggregate_fix.yml to T8205_vyos_user_aggregate_fix.yml * Rename T8205_vyos_user_aggregate_fix.yml to T8205_vyos_user_aggregate_fix.yml Remove unintended whitespace in changelog fragment: T8205_vyos_user_aggregate_fix.yml --------- Co-authored-by: omnom62 <75066712+omnom62@users.noreply.github.com> Co-authored-by: Daniil Baturin --- tests/unit/modules/network/vyos/test_vyos_user.py | 40 +++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to 'tests/unit/modules/network') diff --git a/tests/unit/modules/network/vyos/test_vyos_user.py b/tests/unit/modules/network/vyos/test_vyos_user.py index e8c50783..d1e7f162 100644 --- a/tests/unit/modules/network/vyos/test_vyos_user.py +++ b/tests/unit/modules/network/vyos/test_vyos_user.py @@ -237,3 +237,43 @@ class TestVyosUserModule(TestVyosModule): ), ) result = self.execute_module(changed=False) + + def test_vyos_user_aggregate_with_public_keys(self): + set_module_args( + dict( + aggregate=[ + dict( + name="user1", + public_keys=[ + dict( + name="user1@host1", + key="AAAAC3NzaC1lZDI1NTE5AAAAIFIR0jrMvBdmvTJNY5EDhOD+eixvbOinhY1eBU2u", + type="ssh-ed25519", + ), + ], + ), + dict( + name="user2", + public_keys=[ + dict( + name="user2@host2", + key="AAAAC3NzaC1lZDI1NTE5AAAAIFIR0jrMvBdmvTJNY5EDhOD+eixvbOinhY1eBU2u", + type="ssh-ed25519", + ), + ], + ), + ], + ), + ) + result = self.execute_module(changed=True) + self.assertEqual( + sorted(result["commands"]), + sorted( + [ + "set system login user user1 authentication public-keys user1@host1 key 'AAAAC3NzaC1lZDI1NTE5AAAAIFIR0jrMvBdmvTJNY5EDhOD+eixvbOinhY1eBU2u'", + "set system login user user1 authentication public-keys user1@host1 type 'ssh-ed25519'", + "set system login user user2 authentication public-keys user2@host2 key 'AAAAC3NzaC1lZDI1NTE5AAAAIFIR0jrMvBdmvTJNY5EDhOD+eixvbOinhY1eBU2u'", + "set system login user user2 authentication public-keys user2@host2 type 'ssh-ed25519'", + ], + ), + ) -- cgit v1.2.3