From fb7940fc50cc9f5dd5e794e6c8149f89084cfe05 Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Thu, 5 May 2016 11:14:11 -0400 Subject: [PATCH] check that variable first before using string methods to check for magic interpreter var --- lib/ansible/executor/task_executor.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ansible/executor/task_executor.py b/lib/ansible/executor/task_executor.py index 0af2e2b35c6..2a475c2a106 100644 --- a/lib/ansible/executor/task_executor.py +++ b/lib/ansible/executor/task_executor.py @@ -595,14 +595,14 @@ class TaskExecutor: # since we're delegating, we don't want to use interpreter values # which would have been set for the original target host for i in variables.keys(): - if i.startswith('ansible_') and i.endswith('_interpreter'): + if isinstance(i, string_types) and i.startswith('ansible_') and i.endswith('_interpreter'): del variables[i] # now replace the interpreter values with those that may have come # from the delegated-to host delegated_vars = variables.get('ansible_delegated_vars', dict()).get(self._task.delegate_to, dict()) if isinstance(delegated_vars, dict): for i in delegated_vars: - if i.startswith("ansible_") and i.endswith("_interpreter"): + if isinstance(i, string_types) and i.startswith("ansible_") and i.endswith("_interpreter"): variables[i] = delegated_vars[i] conn_type = self._play_context.connection