mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-22 12:50:22 -07:00
Change network *_user modules to use configured_password to set a users password (#28187)
* WIP, update eos_user args * refactor password for ios_user * add eos tests, fix ios tests * fixed password check * refactor iosxr_user password * fixed password arg for nxos * [WIP] fix vyos_user password * fix vyos tests * update docs for net_user * fix typo * fix eos tests * add warning when attempting to use password arg * fix sanity/unit tests * fix eos unit tests * fix vyos_user aggregate * fix typo in eos documentation string * re add configured_password to vyos tests after rebase
This commit is contained in:
parent
b1d297d144
commit
b818e986b6
18 changed files with 329 additions and 70 deletions
|
@ -54,7 +54,7 @@ class TestEosUserModule(TestEosModule):
|
|||
self.execute_module(changed=True, commands=commands)
|
||||
|
||||
def test_eos_user_password(self):
|
||||
set_module_args(dict(name='ansible', password='test'))
|
||||
set_module_args(dict(name='ansible', configured_password='test'))
|
||||
commands = ['username ansible secret test']
|
||||
self.execute_module(changed=True, commands=commands)
|
||||
|
||||
|
@ -83,15 +83,15 @@ class TestEosUserModule(TestEosModule):
|
|||
self.execute_module(changed=True, commands=commands)
|
||||
|
||||
def test_eos_user_update_password_changed(self):
|
||||
set_module_args(dict(name='test', password='test', update_password='on_create'))
|
||||
set_module_args(dict(name='test', configured_password='test', update_password='on_create'))
|
||||
commands = ['username test secret test']
|
||||
self.execute_module(changed=True, commands=commands)
|
||||
|
||||
def test_eos_user_update_password_on_create_ok(self):
|
||||
set_module_args(dict(name='ansible', password='test', update_password='on_create'))
|
||||
set_module_args(dict(name='ansible', configured_password='test', update_password='on_create'))
|
||||
self.execute_module()
|
||||
|
||||
def test_eos_user_update_password_always(self):
|
||||
set_module_args(dict(name='ansible', password='test', update_password='always'))
|
||||
set_module_args(dict(name='ansible', configured_password='test', update_password='always'))
|
||||
commands = ['username ansible secret test']
|
||||
self.execute_module(changed=True, commands=commands)
|
||||
|
|
|
@ -66,7 +66,7 @@ class TestIosUserModule(TestIosModule):
|
|||
self.assertEqual(result_cmd, [cmd])
|
||||
|
||||
def test_ios_user_password(self):
|
||||
set_module_args(dict(name='ansible', password='test'))
|
||||
set_module_args(dict(name='ansible', configured_password='test'))
|
||||
result = self.execute_module(changed=True)
|
||||
self.assertEqual(result['commands'], ['username ansible secret test'])
|
||||
|
||||
|
@ -100,15 +100,15 @@ class TestIosUserModule(TestIosModule):
|
|||
self.assertEqual(result['commands'], ['username ansible view test'])
|
||||
|
||||
def test_ios_user_update_password_changed(self):
|
||||
set_module_args(dict(name='test', password='test', update_password='on_create'))
|
||||
set_module_args(dict(name='test', configured_password='test', update_password='on_create'))
|
||||
result = self.execute_module(changed=True)
|
||||
self.assertEqual(result['commands'], ['username test secret test'])
|
||||
|
||||
def test_ios_user_update_password_on_create_ok(self):
|
||||
set_module_args(dict(name='ansible', password='test', update_password='on_create'))
|
||||
set_module_args(dict(name='ansible', configured_password='test', update_password='on_create'))
|
||||
self.execute_module()
|
||||
|
||||
def test_ios_user_update_password_always(self):
|
||||
set_module_args(dict(name='ansible', password='test', update_password='always'))
|
||||
set_module_args(dict(name='ansible', configured_password='test', update_password='always'))
|
||||
result = self.execute_module(changed=True)
|
||||
self.assertEqual(result['commands'], ['username ansible secret test'])
|
||||
|
|
|
@ -51,7 +51,7 @@ class TestIosxrUserModule(TestIosxrModule):
|
|||
self.assertEqual(result['commands'], ['no username ansible'])
|
||||
|
||||
def test_iosxr_user_password(self):
|
||||
set_module_args(dict(name='ansible', password='test'))
|
||||
set_module_args(dict(name='ansible', configured_password='test'))
|
||||
result = self.execute_module(changed=True)
|
||||
self.assertEqual(result['commands'], ['username ansible secret test'])
|
||||
|
||||
|
@ -66,16 +66,16 @@ class TestIosxrUserModule(TestIosxrModule):
|
|||
self.assertEqual(result['commands'], ['username ansible group sysadmin'])
|
||||
|
||||
def test_iosxr_user_update_password_changed(self):
|
||||
set_module_args(dict(name='test', password='test', update_password='on_create'))
|
||||
set_module_args(dict(name='test', configured_password='test', update_password='on_create'))
|
||||
result = self.execute_module(changed=True)
|
||||
self.assertEqual(result['commands'],
|
||||
['username test', 'username test secret test'])
|
||||
|
||||
def test_iosxr_user_update_password_on_create_ok(self):
|
||||
set_module_args(dict(name='ansible', password='test', update_password='on_create'))
|
||||
set_module_args(dict(name='ansible', configured_password='test', update_password='on_create'))
|
||||
self.execute_module()
|
||||
|
||||
def test_iosxr_user_update_password_always(self):
|
||||
set_module_args(dict(name='ansible', password='test', update_password='always'))
|
||||
set_module_args(dict(name='ansible', configured_password='test', update_password='always'))
|
||||
result = self.execute_module(changed=True)
|
||||
self.assertEqual(result['commands'], ['username ansible secret test'])
|
||||
|
|
|
@ -46,7 +46,7 @@ class TestVyosUserModule(TestVyosModule):
|
|||
self.load_config.return_value = dict(diff=None, session='session')
|
||||
|
||||
def test_vyos_user_password(self):
|
||||
set_module_args(dict(name='ansible', password='test'))
|
||||
set_module_args(dict(name='ansible', configured_password='test'))
|
||||
result = self.execute_module(changed=True)
|
||||
self.assertEqual(result['commands'], ['set system login user ansible authentication plaintext-password test'])
|
||||
|
||||
|
@ -71,15 +71,15 @@ class TestVyosUserModule(TestVyosModule):
|
|||
'delete system login user admin']))
|
||||
|
||||
def test_vyos_user_update_password_changed(self):
|
||||
set_module_args(dict(name='test', password='test', update_password='on_create'))
|
||||
set_module_args(dict(name='test', configured_password='test', update_password='on_create'))
|
||||
result = self.execute_module(changed=True)
|
||||
self.assertEqual(result['commands'], ['set system login user test authentication plaintext-password test'])
|
||||
|
||||
def test_vyos_user_update_password_on_create_ok(self):
|
||||
set_module_args(dict(name='ansible', password='test', update_password='on_create'))
|
||||
set_module_args(dict(name='ansible', configured_password='test', update_password='on_create'))
|
||||
self.execute_module()
|
||||
|
||||
def test_vyos_user_update_password_always(self):
|
||||
set_module_args(dict(name='ansible', password='test', update_password='always'))
|
||||
set_module_args(dict(name='ansible', configured_password='test', update_password='always'))
|
||||
result = self.execute_module(changed=True)
|
||||
self.assertEqual(result['commands'], ['set system login user ansible authentication plaintext-password test'])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue