Skip to content

Commit

Permalink
fix(modules/gitlab_runners): pass paused to gitlab (ansible-collectio…
Browse files Browse the repository at this point in the history
  • Loading branch information
ap-wtioit authored Aug 1, 2024
1 parent 7bbf32d commit b6c6253
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 2 additions & 0 deletions changelogs/fragments/8648-fix-gitlab-runner-paused.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bugfixes:
- "gitlab_runner - fix ``paused`` parameter being ignored (https://github.com/ansible-collections/community.general/pull/8648)."
9 changes: 7 additions & 2 deletions plugins/modules/gitlab_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,7 @@ def main():
state = module.params['state']
runner_description = module.params['description']
runner_active = module.params['active']
runner_paused = module.params['paused']
tag_list = module.params['tag_list']
run_untagged = module.params['run_untagged']
runner_locked = module.params['locked']
Expand Down Expand Up @@ -500,7 +501,7 @@ def main():
module.exit_json(changed=False, msg="Runner deleted or does not exists")

if state == 'present':
if gitlab_runner.create_or_update_runner(runner_description, {
runner_values = {
"active": runner_active,
"tag_list": tag_list,
"run_untagged": run_untagged,
Expand All @@ -510,7 +511,11 @@ def main():
"registration_token": registration_token,
"group": group,
"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,
msg="Successfully created or updated the runner %s" % runner_description)
else:
Expand Down

0 comments on commit b6c6253

Please sign in to comment.