1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

[PR #6712/e85b0080 backport][stable-6] gitlab_group => Make most options optional (#6724)

gitlab_group => Make most options optional (#6712)

* Make most options optional as they should be

* Add filter to create_group instead

* Remove whitespace

* Add changelog fragment

* Added description and extension to fragment

* Update changelogs/fragments/6712-gitlab_group-filtered-for-none-values.yml

Co-authored-by: Felix Fontein <felix@fontein.de>

* Update plugins/modules/gitlab_group.py

Co-authored-by: Felix Fontein <felix@fontein.de>

* Make Python 2.6 compatible.

* Another shot at compatibility.

---------

Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit e85b008036)

Co-authored-by: Intellium <w.moeken@moeken.eu>
This commit is contained in:
patchback[bot] 2023-06-18 21:27:29 +02:00 committed by GitHub
parent 26ada26df1
commit afd24ccd35
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- gitlab_group - the module passed parameters to the API call even when not set. The module is now filtering out ``None`` values to remediate this (https://github.com/ansible-collections/community.general/pull/6712).

View file

@ -255,7 +255,10 @@ class GitLabGroup(object):
return True return True
try: try:
group = self._gitlab.groups.create(arguments) # Filter out None values
filtered = dict((arg_key, arg_value) for arg_key, arg_value in arguments.items() if arg_value is not None)
group = self._gitlab.groups.create(filtered)
except (gitlab.exceptions.GitlabCreateError) as e: except (gitlab.exceptions.GitlabCreateError) as e:
self._module.fail_json(msg="Failed to create group: %s " % to_native(e)) self._module.fail_json(msg="Failed to create group: %s " % to_native(e))