Skip to content

Commit 7e666a9

Browse files
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
1 parent 2bd4458 commit 7e666a9

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
@@ -343,7 +343,10 @@ def create_or_update_runner(self, description, options):
343343
'''
344344
def create_runner(self, arguments):
345345
if self._module.check_mode:
346-
return True
346+
class MockRunner:
347+
def __init__(self):
348+
self._attrs = {}
349+
return MockRunner()
347350

348351
try:
349352
if arguments.get('token') is not None:

0 commit comments

Comments
 (0)