gitlab: use gitlab instance runner to create runner (#3965) (#4122)

When using project it will use project level runner to create runner that based on python-gitlab it will be used for enabling runner and needs a runner_id so for creating a new runner it should use gitlab level runner

Signed-off-by: Seena Fallah <seenafallah@gmail.com>
(cherry picked from commit 929136808f)

Co-authored-by: Seena Fallah <seenafallah@gmail.com>
pull/4137/head
patchback[bot] 2022-01-31 06:19:59 +01:00 committed by GitHub
parent b9ea3ce19b
commit 15a80aa004
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 3 deletions

View File

@ -0,0 +1,2 @@
bugfixes:
- 'gitlab_runner - use correct API endpoint to create and retrieve project level runners when using ``project`` (https://github.com/ansible-collections/community.general/pull/3965).'

View File

@ -249,7 +249,7 @@ class GitLabRunner(object):
return True
try:
runner = self._runners_endpoint.create(arguments)
runner = self._gitlab.runners.create(arguments)
except (gitlab.exceptions.GitlabCreateError) as e:
self._module.fail_json(msg="Failed to create runner: %s " % to_native(e))
@ -293,10 +293,10 @@ class GitLabRunner(object):
# object, so we need to handle both
if hasattr(runner, "description"):
if (runner.description == description):
return self._runners_endpoint.get(runner.id)
return self._gitlab.runners.get(runner.id)
else:
if (runner['description'] == description):
return self._runners_endpoint.get(runner['id'])
return self._gitlab.runners.get(runner['id'])
'''
@param description Description of the runner