Skip to content

Commit

Permalink
[PR #6712/e85b0080 backport][stable-6] gitlab_group => Make most opti…
Browse files Browse the repository at this point in the history
…ons 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 e85b008)

Co-authored-by: Intellium <w.moeken@moeken.eu>
  • Loading branch information
patchback[bot] and Intellium authored Jun 18, 2023
1 parent 26ada26 commit afd24cc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -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).
5 changes: 4 additions & 1 deletion plugins/modules/gitlab_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,10 @@ def create_group(self, arguments):
return True

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:
self._module.fail_json(msg="Failed to create group: %s " % to_native(e))

Expand Down

0 comments on commit afd24cc

Please sign in to comment.