junos_ping supports only network_cli (#59534)

Signed-off-by: NilashishC <nilashishchakraborty8@gmail.com>
This commit is contained in:
Nilashish Chakraborty 2019-07-24 23:11:27 +05:30 committed by GitHub
parent f2b0bfd4aa
commit 119f2b873a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View file

@ -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
""" """

View file

@ -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)}