From 6c21c545e169f5d68a2c10d285ce3489b28dde2c Mon Sep 17 00:00:00 2001 From: Matt Martz Date: Tue, 13 Feb 2024 09:31:33 -0600 Subject: [PATCH] Deprecate support for the v2 galaxy API (#82543) Co-authored-by: Matt Davis <6775756+nitzmahone@users.noreply.github.com> --- changelogs/fragments/deprecate-v2-galaxy-api.yml | 2 ++ lib/ansible/galaxy/api.py | 9 +++++++++ 2 files changed, 11 insertions(+) create mode 100644 changelogs/fragments/deprecate-v2-galaxy-api.yml diff --git a/changelogs/fragments/deprecate-v2-galaxy-api.yml b/changelogs/fragments/deprecate-v2-galaxy-api.yml new file mode 100644 index 00000000000..a0513da5063 --- /dev/null +++ b/changelogs/fragments/deprecate-v2-galaxy-api.yml @@ -0,0 +1,2 @@ +bugfixes: +- ansible-galaxy - Deprecate use of the Galaxy v2 API (https://github.com/ansible/ansible/issues/81781) diff --git a/lib/ansible/galaxy/api.py b/lib/ansible/galaxy/api.py index ad340415867..156dd4cf700 100644 --- a/lib/ansible/galaxy/api.py +++ b/lib/ansible/galaxy/api.py @@ -133,6 +133,15 @@ def g_connect(versions): % (method.__name__, ", ".join(versions), ", ".join(available_versions), self.name, self.api_server)) + # Warn only when we know we are talking to a collections API + if common_versions == {'v2'}: + display.deprecated( + 'The v2 Ansible Galaxy API is deprecated and no longer supported. ' + 'Ensure that you have configured the ansible-galaxy CLI to utilize an ' + 'updated and supported version of Ansible Galaxy.', + version='2.20' + ) + return method(self, *args, **kwargs) return wrapped return decorator