From 70c78c1d71fe7c3795d98df039b9c4b15a6bfa35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20GATELLIER?= <26511053+lgatellier@users.noreply.github.com> Date: Sun, 19 May 2024 20:47:54 +0200 Subject: [PATCH] gitlab modules: deprecate basic auth method (#8383) --- changelogs/fragments/8383-deprecate-gitlab-basic-auth.yml | 2 ++ plugins/module_utils/gitlab.py | 5 +++++ 2 files changed, 7 insertions(+) create mode 100644 changelogs/fragments/8383-deprecate-gitlab-basic-auth.yml diff --git a/changelogs/fragments/8383-deprecate-gitlab-basic-auth.yml b/changelogs/fragments/8383-deprecate-gitlab-basic-auth.yml new file mode 100644 index 0000000000..b9c35cd0e4 --- /dev/null +++ b/changelogs/fragments/8383-deprecate-gitlab-basic-auth.yml @@ -0,0 +1,2 @@ +deprecated_features: + - "gitlab modules - the basic auth method on GitLab API have been deprecated and will be removed in community.general 10.0.0 (https://github.com/ansible-collections/community.general/pull/8383)." diff --git a/plugins/module_utils/gitlab.py b/plugins/module_utils/gitlab.py index b1354d8a9d..224789a71e 100644 --- a/plugins/module_utils/gitlab.py +++ b/plugins/module_utils/gitlab.py @@ -115,6 +115,11 @@ def gitlab_authentication(module, min_version=None): # Changelog : https://github.com/python-gitlab/python-gitlab/releases/tag/v1.13.0 # This condition allow to still support older version of the python-gitlab library if LooseVersion(gitlab.__version__) < LooseVersion("1.13.0"): + module.deprecate( + "GitLab basic auth is deprecated and will be removed in next major version, " + "using another auth method (API token or OAuth) is strongly recommended.", + version='10.0.0', + collection_name='community.general') gitlab_instance = gitlab.Gitlab(url=gitlab_url, ssl_verify=verify, email=gitlab_user, password=gitlab_password, private_token=gitlab_token, api_version=4) else: