From d1ed72ad373083749fd6d66c340f894ca1d8f5ba Mon Sep 17 00:00:00 2001 From: Peter Sprygada Date: Sat, 25 Mar 2017 07:45:08 -0400 Subject: [PATCH] fixes issue where nxos module will fail due to KeyError (#22966) Updates nxos action handler to handle deleting provider key if exists or silently continuing if a KeyError is raised. (cherry picked from commit 6a414371a194187732a09e0a733cfe3b29e8e06a) --- lib/ansible/plugins/action/nxos.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/ansible/plugins/action/nxos.py b/lib/ansible/plugins/action/nxos.py index 7c8ccfec3d9..df03253c0c8 100644 --- a/lib/ansible/plugins/action/nxos.py +++ b/lib/ansible/plugins/action/nxos.py @@ -116,7 +116,11 @@ class ActionModule(_ActionModule): self._task.args['transport'] = transport result = super(ActionModule, self).run(tmp, task_vars) - del result['invocation']['module_args']['provider'] + + try: + del result['invocation']['module_args']['provider'] + except KeyError: + pass return result