|
|
@ -64,6 +64,7 @@ __metaclass__ = type
|
|
|
|
import abc
|
|
|
|
import abc
|
|
|
|
import logging
|
|
|
|
import logging
|
|
|
|
import os
|
|
|
|
import os
|
|
|
|
|
|
|
|
|
|
|
|
import ansible.utils.shlex
|
|
|
|
import ansible.utils.shlex
|
|
|
|
import ansible.constants as C
|
|
|
|
import ansible.constants as C
|
|
|
|
import ansible.executor.interpreter_discovery
|
|
|
|
import ansible.executor.interpreter_discovery
|
|
|
@ -88,12 +89,12 @@ def run_interpreter_discovery_if_necessary(s, task_vars, action, rediscover_pyth
|
|
|
|
# keep trying different interpreters until we don't error
|
|
|
|
# keep trying different interpreters until we don't error
|
|
|
|
if action._finding_python_interpreter:
|
|
|
|
if action._finding_python_interpreter:
|
|
|
|
return action._possible_python_interpreter
|
|
|
|
return action._possible_python_interpreter
|
|
|
|
|
|
|
|
|
|
|
|
if s in ['auto', 'auto_legacy', 'auto_silent', 'auto_legacy_silent']:
|
|
|
|
if s in ['auto', 'auto_legacy', 'auto_silent', 'auto_legacy_silent']:
|
|
|
|
# python is the only supported interpreter_name as of Ansible 2.8.8
|
|
|
|
# python is the only supported interpreter_name as of Ansible 2.8.8
|
|
|
|
interpreter_name = 'python'
|
|
|
|
interpreter_name = 'python'
|
|
|
|
discovered_interpreter_config = u'discovered_interpreter_%s' % interpreter_name
|
|
|
|
discovered_interpreter_config = u'discovered_interpreter_%s' % interpreter_name
|
|
|
|
|
|
|
|
|
|
|
|
if task_vars.get('ansible_facts') is None:
|
|
|
|
if task_vars.get('ansible_facts') is None:
|
|
|
|
task_vars['ansible_facts'] = {}
|
|
|
|
task_vars['ansible_facts'] = {}
|
|
|
|
|
|
|
|
|
|
|
@ -134,7 +135,7 @@ def run_interpreter_discovery_if_necessary(s, task_vars, action, rediscover_pyth
|
|
|
|
def parse_python_path(s, task_vars, action, rediscover_python):
|
|
|
|
def parse_python_path(s, task_vars, action, rediscover_python):
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
Given the string set for ansible_python_interpeter, parse it using shell
|
|
|
|
Given the string set for ansible_python_interpeter, parse it using shell
|
|
|
|
syntax and return an appropriate argument vector. If the value detected is
|
|
|
|
syntax and return an appropriate argument vector. If the value detected is
|
|
|
|
one of interpreter discovery then run that first. Caches python interpreter
|
|
|
|
one of interpreter discovery then run that first. Caches python interpreter
|
|
|
|
discovery value in `facts_from_task_vars` like how Ansible handles this.
|
|
|
|
discovery value in `facts_from_task_vars` like how Ansible handles this.
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|