Allow delegate_to if transport is not cli (#29945)

Fixes #29060

Allow delegate_to if transport is either nxapi or eapi.

Persistent connection uses `cli` transport and create
a local socket on control node. Hence delegate_to is not allowed
for `cli` transport.

However as `nxapi` and `eapi` transport does not use persistent connection
it is possible to use delegate_to in this case.
This commit is contained in:
Ganesh Nalawade 2017-09-12 21:34:13 +05:30 committed by GitHub
parent b02937f3c3
commit 530988666a
3 changed files with 12 additions and 12 deletions

View file

@ -37,16 +37,16 @@ except ImportError:
class ActionModule(_ActionModule):
def run(self, tmp=None, task_vars=None):
if self._play_context.connection != 'local':
provider = load_provider(nxos_provider_spec, self._task.args)
transport = provider['transport'] or 'cli'
if self._play_context.connection != 'local' and transport == 'cli':
return dict(
failed=True,
msg='invalid connection specified, expected connection=local, '
'got %s' % self._play_context.connection
)
provider = load_provider(nxos_provider_spec, self._task.args)
transport = provider['transport'] or 'cli'
display.vvvv('connection transport is %s' % transport, self._play_context.remote_addr)
if transport == 'cli':