Skip to content

Commit

Permalink
Fixes #6112: community.general.gitlab_runner KeyError: 'access_level' (
Browse files Browse the repository at this point in the history
…#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 c077818)
  • Loading branch information
cfiehe authored and patchback[bot] committed Mar 4, 2023
1 parent 8c1b7e3 commit cc8a2f5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bugfixes:
- gitlab_runner - fix ``KeyError`` on runner creation and update (https://github.com/ansible-collections/community.general/issues/6112).
5 changes: 2 additions & 3 deletions plugins/modules/gitlab_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,9 +234,8 @@ def create_or_update_runner(self, description, options):
'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
Expand All @@ -251,7 +250,7 @@ def create_or_update_runner(self, description, options):
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
Expand Down

0 comments on commit cc8a2f5

Please sign in to comment.