fix KeyError net_base plugin (#34874)

Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
This commit is contained in:
Trishna Guha 2018-01-15 19:24:27 +05:30 committed by GitHub
parent ed806f0fee
commit 43a081d1c9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -60,7 +60,7 @@ class ActionModule(ActionBase):
if play_context.network_os == 'junos':
play_context.connection = 'netconf'
play_context.port = int(self.provider['port'] or self._play_context.port or 830)
elif self.provider['transport'] in ('nxapi', 'eapi') and play_context.network_os in ('nxos', 'eos'):
elif self.provider.get('transport') in ('nxapi', 'eapi') and play_context.network_os in ('nxos', 'eos'):
play_context.connection = play_context.connection
play_context.port = int(self.provider['port'] or self._play_context.port or 22)
else:
@ -78,9 +78,9 @@ class ActionModule(ActionBase):
play_context.become_method = 'enable'
if self._play_context.connection == 'local':
if self.provider['transport'] == 'nxapi' and play_context.network_os == 'nxos':
if self.provider.get('transport') == 'nxapi' and play_context.network_os == 'nxos':
self._task.args['provider'] = _NxosActionModule.nxapi_implementation(self.provider, self._play_context)
elif self.provider['transport'] == 'eapi' and play_context.network_os == 'eos':
elif self.provider.get('transport') == 'eapi' and play_context.network_os == 'eos':
self._task.args['provider'] = _EosActionModule.eapi_implementation(self.provider, self._play_context)
else:
socket_path = self._start_connection(play_context)