Skip to content

Commit

Permalink
Drop python2.6 support in module execution (ansible#76106)
Browse files Browse the repository at this point in the history
  • Loading branch information
sivel authored Oct 25, 2021
1 parent b4cbe1a commit 9b4f9e9
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 18 deletions.
2 changes: 2 additions & 0 deletions changelogs/fragments/drop-target-2.6-support.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
breaking_changes:
- Module Python Dependency - Drop support for Python 2.6 in module execution.
14 changes: 7 additions & 7 deletions docs/docsite/rst/porting_guides/porting_guide_core_2.13.rst
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@

.. _porting_2.13_guide:
.. _porting_2.13_guide_core:

**************************
Ansible 2.13 Porting Guide
**************************
*******************************
Ansible-core 2.13 Porting Guide
*******************************

This section discusses the behavioral changes between Ansible 2.12 and Ansible 2.13.
This section discusses the behavioral changes between ``ansible-core`` 2.12 and ``ansible-core`` 2.13.

It is intended to assist in updating your playbooks, plugins and other parts of your Ansible infrastructure so they will work with this version of Ansible.

We suggest you read this page along with `Ansible Changelog for 2.13 <https://github.com/ansible/ansible/blob/devel/changelogs/CHANGELOG-v2.13.rst>`_ to understand what updates you may need to make.
We suggest you read this page along with `ansible-core Changelog for 2.13 <https://github.com/ansible/ansible/blob/devel/changelogs/CHANGELOG-v2.13.rst>`_ to understand what updates you may need to make.

This document is part of a collection on porting. The complete list of porting guides can be found at :ref:`porting guides <porting_guides>`.

Expand Down Expand Up @@ -37,7 +37,7 @@ No notable changes
Modules
=======

No notable changes
* Python 2.7 is a hard requirement for module execution in this release. Any code utilizing ``ansible.module_utils.basic`` will not function with a lower Python version.


Modules removed
Expand Down
14 changes: 3 additions & 11 deletions lib/ansible/module_utils/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,24 +248,16 @@

# Used for determining if the system is running a new enough python version
# and should only restrict on our documented minimum versions
_PY3_MIN = sys.version_info[:2] >= (3, 5)
_PY2_MIN = (2, 6) <= sys.version_info[:2] < (3,)
_PY26 = (2, 6) == sys.version_info[:2]
_PY3_MIN = sys.version_info >= (3, 5)
_PY2_MIN = (2, 7) <= sys.version_info < (3,)
_PY_MIN = _PY3_MIN or _PY2_MIN
if not _PY_MIN:
print(
'\n{"failed": true, '
'"msg": "ansible-core requires a minimum of Python2 version 2.6 or Python3 version 3.5. Current version: %s"}' % ''.join(sys.version.splitlines())
'"msg": "ansible-core requires a minimum of Python2 version 2.7 or Python3 version 3.5. Current version: %s"}' % ''.join(sys.version.splitlines())
)
sys.exit(1)

if _PY26:
deprecate(
'ansible-core 2.13 will require Python 2.7 or newer on the target. '
'Current version: %s' % ''.join(sys.version.splitlines()),
version='2.13',
)


#
# Deprecated functions
Expand Down

0 comments on commit 9b4f9e9

Please sign in to comment.