network command modules cleanup (#45242)

* Standardize _command modules

* Centralize command transformation process

* Fix check mode error test
This commit is contained in:
Nathaniel Case
2018-09-13 08:55:35 -04:00
committed by GitHub
parent df768914a1
commit 285b927889
11 changed files with 115 additions and 204 deletions

View File

@@ -1,2 +0,0 @@
%No Rollback Confirmed Change pending

View File

@@ -0,0 +1,2 @@

View File

@@ -107,19 +107,20 @@ class TestIosCommandModule(TestIosModule):
set_module_args(dict(commands=commands, wait_for=wait_for, match='all'))
self.execute_module(failed=True)
def test_ios_command_configure_error(self):
def test_ios_command_configure_check_warning(self):
commands = ['configure terminal']
set_module_args({
'commands': commands,
'_ansible_check_mode': True,
})
result = self.execute_module(failed=True)
result = self.execute_module()
self.assertEqual(
result['msg'],
'ios_command does not support running config mode commands. Please use ios_config instead'
result['warnings'],
['Only show commands are supported when using check mode, not executing configure terminal'],
)
def test_ios_command_configure_not_error(self):
commands = ['configure revert now']
def test_ios_command_configure_not_warning(self):
commands = ['configure terminal']
set_module_args(dict(commands=commands))
self.execute_module()
result = self.execute_module()
self.assertEqual(result['warnings'], [])