adds new module net_command for network devices (#19468)

* new module net_command for sending a command to a network device
* adds unit test cases for module
* only works with connection=network_cli
This commit is contained in:
Peter Sprygada 2016-12-19 11:21:37 -05:00 committed by GitHub
parent b77ab1a6c9
commit 2a5a2773c8
6 changed files with 244 additions and 4 deletions

View file

@ -31,6 +31,7 @@ from ansible.template import Templar
RAW_PARAM_MODULES = ([
'command',
'win_command',
'net_command',
'shell',
'win_shell',
'script',
@ -164,7 +165,7 @@ class ModuleArgsParser:
# only internal variables can start with an underscore, so
# we don't allow users to set them directy in arguments
if args and action not in ('command', 'win_command', 'shell', 'win_shell', 'script', 'raw'):
if args and action not in ('command', 'net_command', 'win_command', 'shell', 'win_shell', 'script', 'raw'):
for arg in args:
arg = to_text(arg)
if arg.startswith('_ansible_'):
@ -195,7 +196,7 @@ class ModuleArgsParser:
args = thing
elif isinstance(thing, string_types):
# form is like: local_action: copy src=a dest=b ... pretty common
check_raw = action in ('command', 'win_command', 'shell', 'win_shell', 'script', 'raw')
check_raw = action in ('command', 'net_command', 'win_command', 'shell', 'win_shell', 'script', 'raw')
args = parse_kv(thing, check_raw=check_raw)
elif thing is None:
# this can happen with modules which take no params, like ping: