From ba2917a7dce0fbc3820adcc17387c2e3774c07b7 Mon Sep 17 00:00:00 2001 From: Frederic Werner <20406381+wernerfred@users.noreply.github.com> Date: Mon, 27 Sep 2021 21:49:52 +0200 Subject: [PATCH] chore: add deprecation warning for gitlab group membership (#3451) * chore: add deprecation warning * chore: add deprecation message, version and collection * chore: add changelog fragment * docs: add deprecation info * fix: max line length and whitespace * fix continuation line under-indented * Update changelogs/fragments/3451-gitlab-group-member-deprecate-name-and-path.yml Co-authored-by: Felix Fontein * Update plugins/modules/source_control/gitlab/gitlab_group_members.py Co-authored-by: Felix Fontein Co-authored-by: Felix Fontein --- .../3451-gitlab-group-member-deprecate-name-and-path.yml | 2 ++ .../modules/source_control/gitlab/gitlab_group_members.py | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/3451-gitlab-group-member-deprecate-name-and-path.yml diff --git a/changelogs/fragments/3451-gitlab-group-member-deprecate-name-and-path.yml b/changelogs/fragments/3451-gitlab-group-member-deprecate-name-and-path.yml new file mode 100644 index 0000000000..6b83c18b62 --- /dev/null +++ b/changelogs/fragments/3451-gitlab-group-member-deprecate-name-and-path.yml @@ -0,0 +1,2 @@ +deprecated_features: + - gitlab_group_members - setting ``gitlab_group`` to ``name`` or ``path`` is deprecated. Use ``full_path`` instead (https://github.com/ansible-collections/community.general/pull/3451). diff --git a/plugins/modules/source_control/gitlab/gitlab_group_members.py b/plugins/modules/source_control/gitlab/gitlab_group_members.py index 890f4feba4..8c351aaceb 100644 --- a/plugins/modules/source_control/gitlab/gitlab_group_members.py +++ b/plugins/modules/source_control/gitlab/gitlab_group_members.py @@ -27,7 +27,8 @@ options: type: str gitlab_group: description: - - The name of the GitLab group the member is added to/removed from. + - The C(full_path) of the GitLab group the member is added to/removed from. + - Setting this to C(name) or C(path) is deprecated and will be removed in community.general 6.0.0. Use C(full_path) instead. required: true type: str gitlab_user: @@ -185,6 +186,9 @@ class GitLabGroup(object): return group.id for group in groups: if group.path == gitlab_group or group.name == gitlab_group: + self._module.deprecate( + msg="Setting 'gitlab_group' to 'name' or 'path' is deprecated. Use 'full_path' instead", + version="6.0.0", collection_name="community.general") return group.id # get all members in a group