From 119f2b873a863d05d38a29599ade2ac09f8c6f01 Mon Sep 17 00:00:00 2001 From: Nilashish Chakraborty Date: Wed, 24 Jul 2019 23:11:27 +0530 Subject: [PATCH] junos_ping supports only network_cli (#59534) Signed-off-by: NilashishC --- lib/ansible/modules/network/junos/junos_ping.py | 1 + lib/ansible/plugins/action/junos.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/ansible/modules/network/junos/junos_ping.py b/lib/ansible/modules/network/junos/junos_ping.py index 0b3f36aea8c..8678a9bc053 100644 --- a/lib/ansible/modules/network/junos/junos_ping.py +++ b/lib/ansible/modules/network/junos/junos_ping.py @@ -61,6 +61,7 @@ notes: - For a general purpose network module, see the M(net_ping) module. - For Windows targets, use the M(win_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 """ diff --git a/lib/ansible/plugins/action/junos.py b/lib/ansible/plugins/action/junos.py index 40f6d8dbab7..bd8709d8724 100644 --- a/lib/ansible/plugins/action/junos.py +++ b/lib/ansible/plugins/action/junos.py @@ -31,7 +31,7 @@ from ansible.utils.display import Display display = Display() -CLI_SUPPORTED_MODULES = ['junos_netconf', 'junos_command'] +CLI_SUPPORTED_MODULES = ['junos_netconf', 'junos_ping', 'junos_command'] class ActionModule(ActionNetworkModule): @@ -88,7 +88,7 @@ class ActionModule(ActionNetworkModule): del self._task.args['provider'] 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. " "Please see https://docs.ansible.com/ansible/latest/network/user_guide/platform_junos.html" % (self._play_context.connection, self._task.action)}