ios_command: Whitelist some commands starting with configure (#35363)

* Whitelist some commands starting with `configure`

* Add tests for conditional `configure` rejection
This commit is contained in:
Nathaniel Case 2018-01-26 10:55:50 -05:00 committed by GitHub
parent 4fa02d581d
commit 1f1e5c11a9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 1 deletions

View file

@ -106,3 +106,17 @@ class TestIosCommandModule(TestIosModule):
commands = ['show version', 'show version']
set_module_args(dict(commands=commands, wait_for=wait_for, match='all'))
self.execute_module(failed=True)
def test_ios_command_configure_error(self):
commands = ['configure terminal']
set_module_args(dict(commands=commands))
result = self.execute_module(failed=True)
self.assertEqual(
result['msg'],
'ios_command does not support running config mode commands. Please use ios_config instead'
)
def test_ios_command_configure_not_error(self):
commands = ['configure revert now']
set_module_args(dict(commands=commands))
self.execute_module()