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

[PR #6130/c077818c backport][stable-6] Fixes #6112: community.general.gitlab_runner KeyError: 'access_level' (#6142)

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>
(cherry picked from commit c077818c5d)

Co-authored-by: cfiehe <cfiehe@users.noreply.github.com>
This commit is contained in:
patchback[bot] 2023-03-04 10:38:59 +01:00 committed by GitHub
parent 4860c20108
commit b12113c182
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