mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-16 01:45:25 -07: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:
parent
cef40cb54a
commit
252efcebf5
3 changed files with 41 additions and 11 deletions
|
@ -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
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue