diff options
author | Sam Doran <sdoran@redhat.com> | 2021-08-04 14:17:32 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-04 14:17:32 -0400 |
commit | fa7482c63a654e8bc602fa459aec7520d2fa6f23 (patch) | |
tree | 2fca286b07f55ad295a43ea96760f1a8647ea63b /lib/ansible/executor/interpreter_discovery.py | |
parent | 8d41b97329cae281ce194dbb8cb3ce35fdce23ec (diff) | |
download | ansible-fa7482c63a654e8bc602fa459aec7520d2fa6f23.tar.gz |
Change interpreter discovery defaults to silently prefer Python 3 (#75049)
Push /usr/bin/python to almost the bottom of the barrel. This makes the strategy to prefer
specific versions of the "mystery meat" version.
* Change INTERPRETER_PYTHON default to 'auto'
Change description to match change in behavior.
Change deprecation message to a warning.
* Update docs
* Add porting guide entry
* Update unit tests
* Update integration test
* Allow INTERPRETER_PYTHON_FALLBACK to be configure using a variable
* Prefer platform-python above other Python 2 interpreters
* Add Python 3.10 to the list of interpreters
Diffstat (limited to 'lib/ansible/executor/interpreter_discovery.py')
-rw-r--r-- | lib/ansible/executor/interpreter_discovery.py | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/lib/ansible/executor/interpreter_discovery.py b/lib/ansible/executor/interpreter_discovery.py index 28158aedb3..ff14e608d3 100644 --- a/lib/ansible/executor/interpreter_discovery.py +++ b/lib/ansible/executor/interpreter_discovery.py @@ -116,16 +116,13 @@ def discover_interpreter(action, interpreter_name, discovery_mode, task_vars): # provide a transition period for hosts that were using /usr/bin/python previously (but shouldn't have been) if is_auto_legacy: if platform_interpreter != u'/usr/bin/python' and u'/usr/bin/python' in found_interpreters: - # FIXME: support comments in sivel's deprecation scanner so we can get reminded on this if not is_silent: - action._discovery_deprecation_warnings.append(dict( - msg=u"Distribution {0} {1} on host {2} should use {3}, but is using " - u"/usr/bin/python for backward compatibility with prior Ansible releases. " - u"A future Ansible release will default to using the discovered platform " - u"python for this host. See {4} for more information" - .format(distro, version, host, platform_interpreter, - get_versioned_doclink('reference_appendices/interpreter_discovery.html')), - version='2.12')) + action._discovery_warnings.append( + u"Distribution {0} {1} on host {2} should use {3}, but is using " + u"/usr/bin/python for backward compatibility with prior Ansible releases. " + u"See {4} for more information" + .format(distro, version, host, platform_interpreter, + get_versioned_doclink('reference_appendices/interpreter_discovery.html'))) return u'/usr/bin/python' if platform_interpreter not in found_interpreters: |