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

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>
This commit is contained in:
Intellium 2023-06-18 21:02:21 +02:00 committed by GitHub
parent e06a0e22f7
commit e85b008036
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))