From 97af9aedc814ae6adbe21ca3dddb5a36e4305cf7 Mon Sep 17 00:00:00 2001 From: Evgeni Golov Date: Thu, 7 Nov 2024 07:36:20 +0100 Subject: [PATCH 1/3] Drop support for Ansible 2.9 --- .github/workflows/main.yml | 18 ++++++++---------- Makefile | 3 --- README.md | 4 ++-- ansible.cfg | 3 --- changelogs/fragments/drop-ansible-29.yaml | 2 ++ meta/runtime.yml | 2 +- 6 files changed, 13 insertions(+), 19 deletions(-) create mode 100644 changelogs/fragments/drop-ansible-29.yaml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a8a9addec8..d785a2a560 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -29,9 +29,7 @@ jobs: - devel include: - python: "3.8" - ansible: "v2.9.17" - - python: "3.8" - ansible: "stable-2.10" + ansible: "v2.10.4" - python: "3.6" ansible: "stable-2.11" - python: "3.7" @@ -69,19 +67,19 @@ jobs: if: matrix.container == null - name: Install Ansible run: pip install --upgrade https://github.com/ansible/ansible/archive/${{ matrix.ansible }}.tar.gz - - name: Ensure Jinja version is old enough for Ansible 2.9 + - name: Ensure Jinja version is old enough for Ansible 2.10 run: pip install --upgrade 'Jinja2<3.1' - if: matrix.ansible == 'v2.9.17' + if: matrix.ansible == 'v2.10.4' - name: Install dependencies run: make test-setup - name: prepare a redhat-uep.pem, even if we run on Ubuntu run: sudo mkdir -p /etc/rhsm/ca/ && sudo curl -o /etc/rhsm/ca/redhat-uep.pem https://ftp.redhat.com/redhat/convert2rhel/redhat-uep.pem - - name: Install required collections for ansible-base (2.10+) + - name: Install required collections run: ansible-galaxy collection install https://galaxy.ansible.com/api/v3/plugin/ansible/content/published/collections/artifacts/community-docker-3.12.0.tar.gz - if: matrix.ansible != 'v2.9.17' - - name: Install required collections for ansible 2.9 + if: matrix.ansible != 'v2.10.4' + - name: Install required collections for ansible 2.10 run: ansible-galaxy collection install https://galaxy.ansible.com/api/v3/plugin/ansible/content/published/collections/artifacts/community-docker-2.7.12.tar.gz - if: matrix.ansible == 'v2.9.17' + if: matrix.ansible == 'v2.10.4' - name: Run crud tests run: make test-crud - name: Run other tests @@ -90,7 +88,7 @@ jobs: run: make dist-test - name: Run sanity tests run: make SANITY_OPTS="--docker" sanity - if: matrix.ansible != 'v2.9.17' && matrix.ansible != 'stable-2.10' && matrix.ansible != 'stable-2.11' + if: matrix.ansible != 'v2.10.4' && matrix.ansible != 'stable-2.11' checkmode: runs-on: ubuntu-latest diff --git a/Makefile b/Makefile index 3874cedeb4..e0a3eebf84 100644 --- a/Makefile +++ b/Makefile @@ -13,7 +13,6 @@ $(foreach PLUGIN_TYPE,$(PLUGIN_TYPES),$(eval _$(PLUGIN_TYPE) := $(filter-out %__ DEPENDENCIES := $(METADATA) $(foreach PLUGIN_TYPE,$(PLUGIN_TYPES),$(_$(PLUGIN_TYPE))) $(foreach ROLE,$(ROLES),$(wildcard $(ROLE)/*/*)) $(foreach ROLE,$(ROLES),$(ROLE)/README.md) $(TESTDATA) PYTHON_VERSION = $(shell $(PYTHON_COMMAND) -c 'import sys; print("{}.{}".format(sys.version_info.major, sys.version_info.minor))') -ANSIBLE_SUPPORTS_REDIRECTS = $(shell ansible --version | grep -q 'ansible 2.9' && echo 0 || echo 1) COLLECTION_COMMAND ?= ansible-galaxy SANITY_OPTS = --venv TEST = @@ -103,9 +102,7 @@ tests/test_playbooks/vars/server.yml: dist-test: $(MANIFEST) FOREMAN_SERVER_URL=https://foreman.example.test ansible -m $(NAMESPACE).$(NAME).organization -a "username=admin password=changeme name=collectiontest" localhost | grep -q "Failed to connect to Foreman server.*foreman.example.test" -ifeq ($(ANSIBLE_SUPPORTS_REDIRECTS),1) FOREMAN_SERVER_URL=https://foreman.example.test ansible -m $(NAMESPACE).$(NAME).foreman_organization -a "username=admin password=changeme name=collectiontest" localhost | grep -q "Failed to connect to Foreman server.*foreman.example.test" -endif FOREMAN_SERVER_URL=http://foreman.example.test ansible -m $(NAMESPACE).$(NAME).organization -a "username=admin password=changeme name=collectiontest" localhost 2>&1| grep -q "You have configured a plain HTTP server URL." ansible-doc $(NAMESPACE).$(NAME).organization | grep -q "Manage Organization" diff --git a/README.md b/README.md index b75062e2c1..5c6829e455 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ We actively test the modules against the latest stable Foreman release and the m ### Supported Ansible Versions -The supported Ansible versions are aligned with currently maintained Ansible versions that support Collections (2.9+). +The supported Ansible versions are aligned with currently maintained Ansible versions that support Collections (2.10+). You can find the list of maintained Ansible versions [here](https://docs.ansible.com/ansible/devel/reference_appendices/release_and_maintenance.html). ### Supported Python Versions @@ -108,7 +108,7 @@ And install all specified requirements with `ansible-galaxy install -r requireme ### Building and Installing the Collection Locally -For all currently supported versions of Ansible (i.e. Ansible >= 2.9, and particularly Ansible < 2.10 where the above approach is not yet supported), you can build the collection locally: +For all currently supported versions of Ansible, you can build the collection locally: ```console $ make dist diff --git a/ansible.cfg b/ansible.cfg index ff96a9ad73..2c0ba1a004 100644 --- a/ansible.cfg +++ b/ansible.cfg @@ -1,7 +1,4 @@ [defaults] -# Ansible 2.9 -collections_paths = build/collections -# Ansible 2.10+ collections_path = build/collections inventory = tests/inventory/hosts retry_files_enabled = False diff --git a/changelogs/fragments/drop-ansible-29.yaml b/changelogs/fragments/drop-ansible-29.yaml new file mode 100644 index 0000000000..021da5ae9a --- /dev/null +++ b/changelogs/fragments/drop-ansible-29.yaml @@ -0,0 +1,2 @@ +breaking_changes: + - Drop support for Ansible 2.9. diff --git a/meta/runtime.yml b/meta/runtime.yml index fcb266ec06..891d17ac2e 100644 --- a/meta/runtime.yml +++ b/meta/runtime.yml @@ -193,4 +193,4 @@ plugin_routing: redirect: theforeman.foreman.sync_plan katello_upload: redirect: theforeman.foreman.content_upload -requires_ansible: '>=2.9.17' +requires_ansible: '>=2.10.4' From 872366846da4dd8cc2f46722be7b893dda2f34c8 Mon Sep 17 00:00:00 2001 From: Evgeni Golov Date: Thu, 7 Nov 2024 07:44:04 +0100 Subject: [PATCH 2/3] redhat_manifest: drop Ansible pre 2.9 special casing --- plugins/modules/redhat_manifest.py | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/plugins/modules/redhat_manifest.py b/plugins/modules/redhat_manifest.py index c4293220c1..b8265246bd 100644 --- a/plugins/modules/redhat_manifest.py +++ b/plugins/modules/redhat_manifest.py @@ -154,16 +154,7 @@ def fetch_portal(module, path, method, data=None, accept_header='application/jso fetch_kwargs = {'timeout': 30} if os.path.exists(REDHAT_UEP): fetch_kwargs['ca_path'] = REDHAT_UEP - try: - resp, info = fetch_url(module, url, data, headers, method, **fetch_kwargs) - except TypeError: - # ca_path was added in Ansible 2.9 and backported to 2.8 in 2.8.6 - # older Ansible releases don't support that and we have to omit the CA cert here - if module.params['validate_certs']: - module.warn("Your Ansible version does not support providing custom CA certificates for HTTP requests. " - "Talking to the Red Hat portal might fail without validate_certs=False. Please update.") - del fetch_kwargs['ca_path'] - resp, info = fetch_url(module, url, data, headers, method, **fetch_kwargs) + resp, info = fetch_url(module, url, data, headers, method, **fetch_kwargs) if resp is None or info["status"] >= 400: try: error = json.loads(info['body'])['displayMessage'] From 8f45924fd79df493fac499c351579d0de8257c22 Mon Sep 17 00:00:00 2001 From: Evgeni Golov Date: Thu, 7 Nov 2024 08:27:29 +0100 Subject: [PATCH 3/3] ignore _ansible_internal_redirect_list in callback tests --- tests/test_callback.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_callback.py b/tests/test_callback.py index 6883e0c4af..3a8ca55697 100644 --- a/tests/test_callback.py +++ b/tests/test_callback.py @@ -41,7 +41,7 @@ def drop_incompatible_items(d): for k, v in d.items(): if k in ['msg', 'start', 'end', 'delta', 'uuid', 'timeout', '_ansible_no_log', 'warn', 'connection', 'extended_allitems', 'loop_control', 'expand_argument_vars', 'retries', 'parent', 'parent_type', 'finalized', 'squashed', 'no_log', - 'listen']: + 'listen', '_ansible_internal_redirect_list']: continue if isinstance(v, dict):