Skip to content

Commit ad5acf5

Browse files
felixfonteinshinuza
authored andcommitted
Drop support for ansible-core 2.15; update CI to move ansible-core 2.16 to EOL CI; remove compat code for ansible-core < 2.14 (ansible-collections#10160)
* Drop support for ansible-core 2.15. Move 2.16 to EOL CI. * Remove compatibility code for older ansible-core versions. * Remove commented out parts.
1 parent 64f4a6e commit ad5acf5

File tree

11 files changed

+50
-149
lines changed

11 files changed

+50
-149
lines changed

.azure-pipelines/azure-pipelines.yml

Lines changed: 0 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -96,19 +96,6 @@ stages:
9696
- test: 2
9797
- test: 3
9898
- test: 4
99-
- stage: Sanity_2_16
100-
displayName: Sanity 2.16
101-
dependsOn: []
102-
jobs:
103-
- template: templates/matrix.yml
104-
parameters:
105-
nameFormat: Test {0}
106-
testFormat: 2.16/sanity/{0}
107-
targets:
108-
- test: 1
109-
- test: 2
110-
- test: 3
111-
- test: 4
11299
### Units
113100
- stage: Units_devel
114101
displayName: Units devel
@@ -147,18 +134,6 @@ stages:
147134
targets:
148135
- test: 3.7
149136
- test: "3.12"
150-
- stage: Units_2_16
151-
displayName: Units 2.16
152-
dependsOn: []
153-
jobs:
154-
- template: templates/matrix.yml
155-
parameters:
156-
nameFormat: Python {0}
157-
testFormat: 2.16/units/{0}/1
158-
targets:
159-
- test: 2.7
160-
- test: 3.6
161-
- test: "3.11"
162137

163138
## Remote
164139
- stage: Remote_devel_extra_vms
@@ -235,28 +210,6 @@ stages:
235210
- 1
236211
- 2
237212
- 3
238-
- stage: Remote_2_16
239-
displayName: Remote 2.16
240-
dependsOn: []
241-
jobs:
242-
- template: templates/matrix.yml
243-
parameters:
244-
testFormat: 2.16/{0}
245-
targets:
246-
- name: macOS 13.2
247-
test: macos/13.2
248-
- name: RHEL 9.2
249-
test: rhel/9.2
250-
- name: RHEL 8.8
251-
test: rhel/8.8
252-
- name: RHEL 7.9
253-
test: rhel/7.9
254-
# - name: FreeBSD 13.2
255-
# test: freebsd/13.2
256-
groups:
257-
- 1
258-
- 2
259-
- 3
260213

261214
### Docker
262215
- stage: Docker_devel
@@ -315,26 +268,6 @@ stages:
315268
- 1
316269
- 2
317270
- 3
318-
- stage: Docker_2_16
319-
displayName: Docker 2.16
320-
dependsOn: []
321-
jobs:
322-
- template: templates/matrix.yml
323-
parameters:
324-
testFormat: 2.16/linux/{0}
325-
targets:
326-
- name: Fedora 38
327-
test: fedora38
328-
- name: openSUSE 15
329-
test: opensuse15
330-
- name: Alpine 3
331-
test: alpine3
332-
- name: CentOS 7
333-
test: centos7
334-
groups:
335-
- 1
336-
- 2
337-
- 3
338271

339272
### Community Docker
340273
- stage: Docker_community_devel
@@ -392,44 +325,27 @@ stages:
392325
# targets:
393326
# - test: '3.7'
394327
# - test: '3.12'
395-
# - stage: Generic_2_16
396-
# displayName: Generic 2.16
397-
# dependsOn: []
398-
# jobs:
399-
# - template: templates/matrix.yml
400-
# parameters:
401-
# nameFormat: Python {0}
402-
# testFormat: 2.16/generic/{0}/1
403-
# targets:
404-
# - test: '2.7'
405-
# - test: '3.6'
406-
# - test: '3.11'
407328

408329
- stage: Summary
409330
condition: succeededOrFailed()
410331
dependsOn:
411332
- Sanity_devel
412333
- Sanity_2_18
413334
- Sanity_2_17
414-
- Sanity_2_16
415335
- Units_devel
416336
- Units_2_18
417337
- Units_2_17
418-
- Units_2_16
419338
- Remote_devel_extra_vms
420339
- Remote_devel
421340
- Remote_2_18
422341
- Remote_2_17
423-
- Remote_2_16
424342
- Docker_devel
425343
- Docker_2_18
426344
- Docker_2_17
427-
- Docker_2_16
428345
- Docker_community_devel
429346
# Right now all generic tests are disabled. Uncomment when at least one of them is re-enabled.
430347
# - Generic_devel
431348
# - Generic_2_18
432349
# - Generic_2_17
433-
# - Generic_2_16
434350
jobs:
435351
- template: templates/coverage.yml

.github/workflows/ansible-test.yml

Lines changed: 38 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
strategy:
3030
matrix:
3131
ansible:
32-
- '2.15'
32+
- '2.16'
3333
runs-on: ubuntu-latest
3434
steps:
3535
- name: Perform sanity testing
@@ -57,12 +57,12 @@ jobs:
5757
exclude:
5858
- ansible: ''
5959
include:
60-
- ansible: '2.15'
60+
- ansible: '2.16'
6161
python: '2.7'
62-
- ansible: '2.15'
63-
python: '3.5'
64-
- ansible: '2.15'
65-
python: '3.10'
62+
- ansible: '2.16'
63+
python: '3.6'
64+
- ansible: '2.16'
65+
python: '3.11'
6666

6767
steps:
6868
- name: >-
@@ -98,43 +98,56 @@ jobs:
9898
exclude:
9999
- ansible: ''
100100
include:
101-
# 2.15
102-
- ansible: '2.15'
103-
docker: alpine3
101+
# 2.16
102+
# CentOS 7 does not work in GHA, that's why it's not listed here.
103+
- ansible: '2.16'
104+
docker: fedora38
104105
python: ''
105106
target: azp/posix/1/
106-
- ansible: '2.15'
107-
docker: alpine3
107+
- ansible: '2.16'
108+
docker: fedora38
108109
python: ''
109110
target: azp/posix/2/
110-
- ansible: '2.15'
111-
docker: alpine3
111+
- ansible: '2.16'
112+
docker: fedora38
113+
python: ''
114+
target: azp/posix/3/
115+
- ansible: '2.16'
116+
docker: opensuse15
117+
python: ''
118+
target: azp/posix/1/
119+
- ansible: '2.16'
120+
docker: opensuse15
121+
python: ''
122+
target: azp/posix/2/
123+
- ansible: '2.16'
124+
docker: opensuse15
112125
python: ''
113126
target: azp/posix/3/
114-
- ansible: '2.15'
115-
docker: fedora37
127+
- ansible: '2.16'
128+
docker: alpine3
116129
python: ''
117130
target: azp/posix/1/
118-
- ansible: '2.15'
119-
docker: fedora37
131+
- ansible: '2.16'
132+
docker: alpine3
120133
python: ''
121134
target: azp/posix/2/
122-
- ansible: '2.15'
123-
docker: fedora37
135+
- ansible: '2.16'
136+
docker: alpine3
124137
python: ''
125138
target: azp/posix/3/
126139
# Right now all generic tests are disabled. Uncomment when at least one of them is re-enabled.
127-
# - ansible: '2.13'
140+
# - ansible: '2.16'
128141
# docker: default
129-
# python: '3.9'
142+
# python: '2.7'
130143
# target: azp/generic/1/
131-
# - ansible: '2.14'
144+
# - ansible: '2.16'
132145
# docker: default
133-
# python: '3.10'
146+
# python: '3.6'
134147
# target: azp/generic/1/
135-
# - ansible: '2.15'
148+
# - ansible: '2.16'
136149
# docker: default
137-
# python: '3.9'
150+
# python: '3.11'
138151
# target: azp/generic/1/
139152

140153
steps:

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ For more information about communication, see the [Ansible communication guide](
3939

4040
## Tested with Ansible
4141

42-
Tested with the current ansible-core 2.15, ansible-core 2.16, ansible-core 2.17, ansible-core 2.18 releases and the current development version of ansible-core. Ansible-core versions before 2.15.0 are not supported. This includes all ansible-base 2.10 and Ansible 2.9 releases.
42+
Tested with the current ansible-core 2.16, ansible-core 2.17, ansible-core 2.18 releases and the current development version of ansible-core. Ansible-core versions before 2.16.0 are not supported. This includes all ansible-base 2.10 and Ansible 2.9 releases.
4343

4444
## External requirements
4545

antsibull-nox.toml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,6 @@
88
"community.docker" = "git+https://github.com/ansible-collections/community.docker.git,main"
99
"community.internal_test_tools" = "git+https://github.com/ansible-collections/community.internal_test_tools.git,main"
1010

11-
[collection_sources_per_ansible.'2.15']
12-
# community.crypto's main branch needs ansible-core >= 2.17
13-
"community.crypto" = "git+https://github.com/ansible-collections/community.crypto.git,stable-2"
14-
1511
[collection_sources_per_ansible.'2.16']
1612
# community.crypto's main branch needs ansible-core >= 2.17
1713
"community.crypto" = "git+https://github.com/ansible-collections/community.crypto.git,stable-2"
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
removed_features:
2+
- "Dropped support for ansible-core 2.15. The collection now requires ansible-core 2.16 or newer. This means that on the controller, Python 3.10+ is required. On the target side, Python 2.7 and Python 3.6+ are supported (https://github.com/ansible-collections/community.general/pull/10160)."
3+
minor_changes:
4+
- "cartesian lookup plugin - removed compatibility code for ansible-core < 2.14 (https://github.com/ansible-collections/community.general/pull/10160)."
5+
- "dependent lookup plugin - removed compatibility code for ansible-core < 2.14 (https://github.com/ansible-collections/community.general/pull/10160)."
6+
- "flattened lookup plugin - removed compatibility code for ansible-core < 2.14 (https://github.com/ansible-collections/community.general/pull/10160)."
7+
- "redfish module utils - removed compatibility code for ansible-core < 2.14 (https://github.com/ansible-collections/community.general/pull/10160)."

meta/runtime.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
44
# SPDX-License-Identifier: GPL-3.0-or-later
55

6-
requires_ansible: '>=2.15.0'
6+
requires_ansible: '>=2.16.0'
77
action_groups:
88
consul:
99
- consul_agent_check

plugins/lookup/cartesian.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,7 @@ def _lookup_variables(self, terms):
6666
"""
6767
results = []
6868
for x in terms:
69-
try:
70-
intermediate = listify_lookup_plugin_terms(x, templar=self._templar)
71-
except TypeError:
72-
# The loader argument is deprecated in ansible-core 2.14+. Fall back to
73-
# pre-2.14 behavior for older ansible-core versions.
74-
intermediate = listify_lookup_plugin_terms(x, templar=self._templar, loader=self._loader)
75-
results.append(intermediate)
69+
results.append(listify_lookup_plugin_terms(x, templar=self._templar))
7670
return results
7771

7872
def run(self, terms, variables=None, **kwargs):

plugins/lookup/dependent.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -127,20 +127,13 @@
127127
from ansible.release import __version__ as ansible_version
128128
from ansible.template import Templar
129129

130-
from ansible_collections.community.general.plugins.module_utils.version import LooseVersion
131-
132130
try:
133131
from ansible.template import trust_as_template as _trust_as_template
134132
HAS_DATATAGGING = True
135133
except ImportError:
136134
HAS_DATATAGGING = False
137135

138136

139-
# Whether Templar has a cache, which can be controlled by Templar.template()'s cache option.
140-
# The cache was removed for ansible-core 2.14 (https://github.com/ansible/ansible/pull/78419)
141-
_TEMPLAR_HAS_TEMPLATE_CACHE = LooseVersion(ansible_version) < LooseVersion('2.14.0')
142-
143-
144137
def _make_safe(value):
145138
if HAS_DATATAGGING and isinstance(value, str):
146139
return _trust_as_template(value)
@@ -156,8 +149,6 @@ def __evaluate(self, expression, templar, variables):
156149
"""
157150
templar.available_variables = variables or {}
158151
quoted_expression = "{0}{1}{2}".format("{{", expression, "}}")
159-
if _TEMPLAR_HAS_TEMPLATE_CACHE:
160-
return templar.template(quoted_expression, cache=False)
161152
if hasattr(templar, 'evaluate_expression'):
162153
# This is available since the Data Tagging PR has been merged
163154
return templar.evaluate_expression(_make_safe(expression))

plugins/lookup/flattened.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,7 @@ def _do_flatten(self, terms, variables):
6767

6868
if isinstance(term, string_types):
6969
# convert a variable to a list
70-
try:
71-
term2 = listify_lookup_plugin_terms(term, templar=self._templar)
72-
except TypeError:
73-
# The loader argument is deprecated in ansible-core 2.14+. Fall back to
74-
# pre-2.14 behavior for older ansible-core versions.
75-
term2 = listify_lookup_plugin_terms(term, templar=self._templar, loader=self._loader)
70+
term2 = listify_lookup_plugin_terms(term, templar=self._templar)
7671
# but avoid converting a plain string to a list of one string
7772
if term2 != [term]:
7873
term = term2

plugins/module_utils/redfish_utils.py

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@
1010
import os
1111
import random
1212
import string
13-
import gzip
1413
import time
15-
from io import BytesIO
1614
from ansible.module_utils.urls import open_url
1715
from ansible.module_utils.common.text.converters import to_native
1816
from ansible.module_utils.common.text.converters import to_text
@@ -21,8 +19,6 @@
2119
from ansible.module_utils.six.moves import http_client
2220
from ansible.module_utils.six.moves.urllib.error import URLError, HTTPError
2321
from ansible.module_utils.six.moves.urllib.parse import urlparse
24-
from ansible.module_utils.ansible_release import __version__ as ansible_version
25-
from ansible_collections.community.general.plugins.module_utils.version import LooseVersion
2622

2723
GET_HEADERS = {'accept': 'application/json', 'OData-Version': '4.0'}
2824
POST_HEADERS = {'content-type': 'application/json', 'accept': 'application/json',
@@ -183,12 +179,7 @@ def get_request(self, uri, override_headers=None, allow_no_resp=False, timeout=N
183179
timeout=timeout,
184180
)
185181
try:
186-
if headers.get('content-encoding') == 'gzip' and LooseVersion(ansible_version) < LooseVersion('2.14'):
187-
# Older versions of Ansible do not automatically decompress the data
188-
# Starting in 2.14, open_url will decompress the response data by default
189-
data = json.loads(to_native(gzip.open(BytesIO(resp.read()), 'rt', encoding='utf-8').read()))
190-
else:
191-
data = json.loads(to_native(resp.read()))
182+
data = json.loads(to_native(resp.read()))
192183
except Exception as e:
193184
# No response data; this is okay in certain cases
194185
data = None

0 commit comments

Comments
 (0)