junos_ping supports only network_cli (#59534)
Signed-off-by: NilashishC <nilashishchakraborty8@gmail.com>
This commit is contained in:
parent
f2b0bfd4aa
commit
119f2b873a
2 changed files with 3 additions and 2 deletions
|
@ -61,6 +61,7 @@ notes:
|
||||||
- For a general purpose network module, see the M(net_ping) module.
|
- For a general purpose network module, see the M(net_ping) module.
|
||||||
- For Windows targets, use the M(win_ping) module instead.
|
- For Windows targets, use the M(win_ping) module instead.
|
||||||
- For targets running Python, use the M(ping) module instead.
|
- For targets running Python, use the M(ping) module instead.
|
||||||
|
- This module works only with connection C(network_cli).
|
||||||
extends_documentation_fragment: junos
|
extends_documentation_fragment: junos
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ from ansible.utils.display import Display
|
||||||
|
|
||||||
display = Display()
|
display = Display()
|
||||||
|
|
||||||
CLI_SUPPORTED_MODULES = ['junos_netconf', 'junos_command']
|
CLI_SUPPORTED_MODULES = ['junos_netconf', 'junos_ping', 'junos_command']
|
||||||
|
|
||||||
|
|
||||||
class ActionModule(ActionNetworkModule):
|
class ActionModule(ActionNetworkModule):
|
||||||
|
@ -88,7 +88,7 @@ class ActionModule(ActionNetworkModule):
|
||||||
del self._task.args['provider']
|
del self._task.args['provider']
|
||||||
|
|
||||||
if (self._play_context.connection == 'network_cli' and self._task.action not in CLI_SUPPORTED_MODULES) or \
|
if (self._play_context.connection == 'network_cli' and self._task.action not in CLI_SUPPORTED_MODULES) or \
|
||||||
(self._play_context.connection == 'netconf' and self._task.action == 'junos_netconf'):
|
(self._play_context.connection == 'netconf' and self._task.action in CLI_SUPPORTED_MODULES[0:2]):
|
||||||
return {'failed': True, 'msg': "Connection type '%s' is not valid for '%s' module. "
|
return {'failed': True, 'msg': "Connection type '%s' is not valid for '%s' module. "
|
||||||
"Please see https://docs.ansible.com/ansible/latest/network/user_guide/platform_junos.html"
|
"Please see https://docs.ansible.com/ansible/latest/network/user_guide/platform_junos.html"
|
||||||
% (self._play_context.connection, self._task.action)}
|
% (self._play_context.connection, self._task.action)}
|
||||||
|
|
Loading…
Reference in a new issue