From 43a081d1c9b9d8454333027b7d998b99d7c97136 Mon Sep 17 00:00:00 2001 From: Trishna Guha Date: Mon, 15 Jan 2018 19:24:27 +0530 Subject: [PATCH] fix KeyError net_base plugin (#34874) Signed-off-by: Trishna Guha --- lib/ansible/plugins/action/net_base.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/ansible/plugins/action/net_base.py b/lib/ansible/plugins/action/net_base.py index a87736c46d..7ed726e1ad 100644 --- a/lib/ansible/plugins/action/net_base.py +++ b/lib/ansible/plugins/action/net_base.py @@ -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)