Fix junos transport check (#38460)

For connection=local check only if the transport value in
provider is cli and the respective module support cli
transport. If not report back appropriate error message.
This commit is contained in:
Ganesh Nalawade 2018-04-09 16:22:09 +05:30 committed by GitHub
commit e10e0d42d8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -57,8 +57,7 @@ class ActionModule(_ActionModule):
pc.network_os = 'junos' pc.network_os = 'junos'
pc.remote_addr = provider['host'] or self._play_context.remote_addr pc.remote_addr = provider['host'] or self._play_context.remote_addr
if (provider['transport'] == 'cli' and self._task.action not in CLI_SUPPORTED_MODULES) or \ if provider['transport'] == 'cli' and self._task.action not in CLI_SUPPORTED_MODULES:
(provider['transport'] == 'netconf' and self._task.action == 'junos_netconf'):
return {'failed': True, 'msg': "Transport type '%s' is not valid for '%s' module. " return {'failed': True, 'msg': "Transport type '%s' is not valid for '%s' module. "
"Please see http://docs.ansible.com/ansible/latest/network/user_guide/platform_junos.html" "Please see http://docs.ansible.com/ansible/latest/network/user_guide/platform_junos.html"
% (provider['transport'], self._task.action)} % (provider['transport'], self._task.action)}