Fix issue on nxos modules when transport is passed via provider (#22488)

The nxos modules read the task level transport variable, thus if
the user pass it via provider the all fail with an UnboundLocalError.

Fixes #22355
This commit is contained in:
Ricardo Carrillo Cruz 2017-03-10 15:32:24 +01:00 committed by Chris Alfonso
parent 0433be33bd
commit 9173a7727c

View file

@ -99,10 +99,7 @@ class ActionModule(_ActionModule):
self._task.args['provider'] = provider_arg
# make sure a transport value is set in args
transport = self._task.args.get('transport')
provider_transport = (self._task.args.get('provider') or {}).get('transport')
if all((transport is None, provider_transport is None)):
self._task.args['transport'] = 'cli'
self._task.args['transport'] = transport
return super(ActionModule, self).run(tmp, task_vars)