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

[PR #8648/b6c6253b backport][stable-9] fix(modules/gitlab_runners): pass paused to gitlab (#8701)

fix(modules/gitlab_runners): pass paused to gitlab (#8648)

(cherry picked from commit b6c6253bfc)

Co-authored-by: Andreas Perhab <a.perhab@wtioit.at>
This commit is contained in:
patchback[bot] 2024-08-01 17:33:11 +02:00 committed by GitHub
parent 31a147f0eb
commit f9acef140f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 9 additions and 2 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- "gitlab_runner - fix ``paused`` parameter being ignored (https://github.com/ansible-collections/community.general/pull/8648)."

View file

@ -466,6 +466,7 @@ def main():
state = module.params['state'] state = module.params['state']
runner_description = module.params['description'] runner_description = module.params['description']
runner_active = module.params['active'] runner_active = module.params['active']
runner_paused = module.params['paused']
tag_list = module.params['tag_list'] tag_list = module.params['tag_list']
run_untagged = module.params['run_untagged'] run_untagged = module.params['run_untagged']
runner_locked = module.params['locked'] runner_locked = module.params['locked']
@ -500,7 +501,7 @@ def main():
module.exit_json(changed=False, msg="Runner deleted or does not exists") module.exit_json(changed=False, msg="Runner deleted or does not exists")
if state == 'present': if state == 'present':
if gitlab_runner.create_or_update_runner(runner_description, { runner_values = {
"active": runner_active, "active": runner_active,
"tag_list": tag_list, "tag_list": tag_list,
"run_untagged": run_untagged, "run_untagged": run_untagged,
@ -510,7 +511,11 @@ def main():
"registration_token": registration_token, "registration_token": registration_token,
"group": group, "group": group,
"project": project, "project": project,
}): }
if LooseVersion(gitlab_runner._gitlab.version()[0]) >= LooseVersion("14.8.0"):
# the paused attribute for runners is available since 14.8
runner_values["paused"] = runner_paused
if gitlab_runner.create_or_update_runner(runner_description, runner_values):
module.exit_json(changed=True, runner=gitlab_runner.runner_object._attrs, module.exit_json(changed=True, runner=gitlab_runner.runner_object._attrs,
msg="Successfully created or updated the runner %s" % runner_description) msg="Successfully created or updated the runner %s" % runner_description)
else: else: