mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 21:32:49 +00:00
module should fail if eos_user is added without configured_password or nopassword or sshkey (#28780)
* module should fail if eos_user is added without configured_password or nopassword or sshkey Signed-off-by: Trishna Guha <trishnaguha17@gmail.com> * fix eos_user unit test Signed-off-by: Trishna Guha <trishnaguha17@gmail.com> * fix eos_user integration test Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
This commit is contained in:
@@ -200,6 +200,11 @@ def map_obj_to_commands(updates, module):
|
||||
else:
|
||||
add('no username %s nopassword' % want['name'])
|
||||
|
||||
if want.get('state') == 'present' and want.get('name'):
|
||||
value = [want.get('configured_password'), want.get('nopassword'), want.get('sshkey')]
|
||||
if all(v is None for v in value) is True:
|
||||
module.fail_json(msg='configured_password, sshkey or nopassword should be provided')
|
||||
|
||||
return commands
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user