check that variable first
before using string methods to check for magic interpreter var
This commit is contained in:
parent
a355ebcbb8
commit
90fef85143
1 changed files with 2 additions and 2 deletions
|
@ -595,14 +595,14 @@ class TaskExecutor:
|
||||||
# since we're delegating, we don't want to use interpreter values
|
# since we're delegating, we don't want to use interpreter values
|
||||||
# which would have been set for the original target host
|
# which would have been set for the original target host
|
||||||
for i in variables.keys():
|
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]
|
del variables[i]
|
||||||
# now replace the interpreter values with those that may have come
|
# now replace the interpreter values with those that may have come
|
||||||
# from the delegated-to host
|
# from the delegated-to host
|
||||||
delegated_vars = variables.get('ansible_delegated_vars', dict()).get(self._task.delegate_to, dict())
|
delegated_vars = variables.get('ansible_delegated_vars', dict()).get(self._task.delegate_to, dict())
|
||||||
if isinstance(delegated_vars, dict):
|
if isinstance(delegated_vars, dict):
|
||||||
for i in delegated_vars:
|
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]
|
variables[i] = delegated_vars[i]
|
||||||
|
|
||||||
conn_type = self._play_context.connection
|
conn_type = self._play_context.connection
|
||||||
|
|
Loading…
Reference in a new issue