1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Add junos connection type check (#38527)

junos_netconf works only with connection=netconf
Add check to report appropriate error if any other
connection type is used.
This commit is contained in:
Ganesh Nalawade 2018-04-11 12:07:56 +05:30 committed by GitHub
parent 53d3e7e306
commit 16c2d3717e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -90,7 +90,8 @@ class ActionModule(_ActionModule):
if any(provider.values()):
display.warning('provider is unnecessary when using connection=%s and will be ignored' % self._play_context.connection)
if self._play_context.connection == 'network_cli' and self._task.action not in CLI_SUPPORTED_MODULES:
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'):
return {'failed': True, 'msg': "Connection type '%s' is not valid for '%s' module. "
"Please see http://docs.ansible.com/ansible/latest/network/user_guide/platform_junos.html"
% (self._play_context.connection, self._task.action)}