Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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