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

Fixes #6112: community.general.gitlab_runner KeyError: 'access_level' (#6130)

The fix ensures that no 'KeyError' is raised, when 'access_level' is not provided as module parameter or when 'access_level_on_creation' is false.

Signed-off-by: Christoph Fiehe <c.fiehe@eurodata.de>
Co-authored-by: Christoph Fiehe <c.fiehe@eurodata.de>
This commit is contained in:
cfiehe 2023-03-04 10:14:58 +01:00 committed by GitHub
parent 3d67f51824
commit c077818c5d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- gitlab_runner - fix ``KeyError`` on runner creation and update (https://github.com/ansible-collections/community.general/issues/6112).

View file

@ -234,9 +234,8 @@ class GitLabRunner(object):
'maximum_timeout': options['maximum_timeout'],
'tag_list': options['tag_list'],
}
if arguments['access_level'] is not None:
if options.get('access_level') is not None:
arguments['access_level'] = options['access_level']
# Because we have already call userExists in main()
if self.runner_object is None:
arguments['description'] = description
@ -251,7 +250,7 @@ class GitLabRunner(object):
access_level_on_creation = False
if not access_level_on_creation:
del arguments['access_level']
arguments.pop('access_level', None)
runner = self.create_runner(arguments)
changed = True