Skip to content

Commit a6bc4cf

Browse files
carlfriedrichpatchback[bot]
authored andcommitted
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 7e666a9)
1 parent 3a2ce4a commit a6bc4cf

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
bugfixes:
2+
- gitlab_runner - fix exception in check mode when a new runner is created (https://github.com/ansible-collections/community.general/issues/8854).

plugins/modules/gitlab_runner.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,10 @@ def create_or_update_runner(self, description, options):
345345
'''
346346
def create_runner(self, arguments):
347347
if self._module.check_mode:
348-
return True
348+
class MockRunner:
349+
def __init__(self):
350+
self._attrs = {}
351+
return MockRunner()
349352

350353
try:
351354
if arguments.get('token') is not None:

0 commit comments

Comments
 (0)