fixes issue with cli shell left open (#21548)

The nxos action plugin will now close the shell connection once the
module has completely run
This commit is contained in:
Peter Sprygada 2017-02-16 22:11:32 -05:00 committed by GitHub
commit c9f6a2b740
2 changed files with 30 additions and 12 deletions

View file

@ -68,11 +68,12 @@ def get_connection(module):
global _DEVICE_CONNECTION
if not _DEVICE_CONNECTION:
load_params(module)
transport = module.params['transport']
if transport == 'cli':
if 'transport' not in module.params:
conn = Cli(module)
elif transport == 'nxapi':
elif module.params['transport'] == 'nxapi':
conn = Nxapi(module)
else:
conn = Cli(module)
_DEVICE_CONNECTION = conn
return _DEVICE_CONNECTION