1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2026-02-04 07:51:50 +00:00

[PR #10918/7e666a9c backport][stable-11] fix(modules/gitlab_runner): Fix exception in check mode on new runners (#10944)

fix(modules/gitlab_runner): Fix exception in check mode on new runners (#10918)

* fix(modules/gitlab_runner): Fix exception in check mode on new runners

When a new runner is added in check mode, the role used to throw an
exception. Fix this by returning a valid runner object instead of a
boolean.

Fixes #8854

* docs: Add changelog fragment

(cherry picked from commit 7e666a9c31)

Co-authored-by: carlfriedrich <carlfriedrich@posteo.de>
This commit is contained in:
patchback[bot] 2025-10-19 09:31:24 +02:00 committed by GitHub
parent 3a2ce4add5
commit e757adbfca
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 1 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- gitlab_runner - fix exception in check mode when a new runner is created (https://github.com/ansible-collections/community.general/issues/8854).

View file

@ -345,7 +345,10 @@ class GitLabRunner(object):
'''
def create_runner(self, arguments):
if self._module.check_mode:
return True
class MockRunner:
def __init__(self):
self._attrs = {}
return MockRunner()
try:
if arguments.get('token') is not None: