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

fixes mapping nxapi arguments for nxos action plugin (#22491)

The nxos action plugin does not properly map task arguments when using
provider.  This patch will fix the problem and properly map the
arguments
This commit is contained in:
Peter Sprygada 2017-03-11 09:46:15 -06:00 committed by GitHub
parent 027f5955cc
commit 17fc6832ca

View file

@ -86,17 +86,30 @@ class ActionModule(_ActionModule):
task_vars['ansible_socket'] = socket_path task_vars['ansible_socket'] = socket_path
else: else:
provider_arg = { provider['transport'] = 'nxapi'
'transport': 'nxapi',
'host': self._play_context.remote_addr, if provider.get('host') is None:
'port': provider.get('port'), provider['host'] = self._play_context.remote_addr
'username': provider.get('username') or self._play_context.connection_user,
'password': provider.get('password') or self._play_context.password, if provider.get('port') is None:
'timeout': provider.get('timeout') or self._play_context.timeout, provider['port'] = 80
'use_ssl': task_vars.get('nxapi_use_ssl') or False,
'validate_certs': task_vars.get('nxapi_validate_certs') or True if provider.get('timeout') is None:
} provider['timeout'] = self._play_context.timeout
self._task.args['provider'] = provider_arg
if provider.get('username') is None:
provider['username'] = self._play_context.connection_user
if provider.get('password') is None:
provider['password'] = self._play_context.password
if provider.get('use_ssl') is None:
provider['use_ssl'] = False
if provider.get('validate_certs') is None:
provider['validate_certs'] = True
self._task.args['provider'] = provider
# make sure a transport value is set in args # make sure a transport value is set in args
self._task.args['transport'] = transport self._task.args['transport'] = transport