Closed atoom closed 1 month ago
Files identified in the description:
None
If these files are incorrect, please update the component name
section of the description or use the component bot command.
Duplicate of https://github.com/ansible/ansible/issues/77840
@sivel Thanks for taking a look at this issue!
I agree that there is overlap with issue #77840 but I would argue that this problem is a regression bug introduced in Ansible core 2.17.x via the commit I referenced in the issue description.
From my understanding of the code starting from 2.17.x the lookup in platform_python_map
will always be a miss and the NotImplementedError
will always be thrown resulting in much of the implementation for interpreter_python
setting is ignored and basically every ansible execution that requires interpreter discovery will print the interpreter discovery warning.
Can you take a second look and see if I misunderstand something ?
closing in favor of #77840
Summary
When upgrading from Ansible 8.x to Ansible 10.x we have run into issues on hosts with multiple Python installations. In order to force the use of system python on all hosts we have set
interpreter_python
toauto_legacy
inansible.cfg
however the "wrong" python is discovered.After looking at the code for the python discovery implementation (https://github.com/ansible/ansible/blob/devel/lib/ansible/executor/interpreter_discovery.py) and adding some debug lines to see what's going on it seems that the following block is always executed:
The exception is caught with the following try/catch code:
And finally the discovery logic ends with:
The reason for this seems to be in the following commit: https://github.com/ansible/ansible/commit/5566a655ae9de3343a5c8b2e370cb157c35c52cb where the
_INTERPRETER_PYTHON_DISTRO_MAP
inlib/ansible/config/base.yml
is replaced with test data only.From the way I see it the NotImplementedError will always be thrown and the rest of the interpreter discovery logic will be skipped and thus any configuration in the
interpreter_python
will be ignored ?Issue Type
Bug Report
Component Name
core
Ansible Version
Configuration
OS / Environment
RHEL 9
Steps to Reproduce
Expected Results
Ansible fact
discovered_interpreter_python
should be set to /usr/bin/python3Actual Results
Code of Conduct