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

Fix: gitlab_deploy_key idempotency (#3473) (#3511)

* Fix: gitlab_deploy_key idempotency

The module was not retrieving all the deploy keys leading to non
idempotency on projects with multiple deploy keys.
SEE: https://python-gitlab.readthedocs.io/en/stable/api-usage.html#pagination

* Update changelogs/fragments/3473-gitlab_deploy_key-fix_idempotency.yml

Co-authored-by: Felix Fontein <felix@fontein.de>

Co-authored-by: Jonathan Piron <jonathanpiron@gmail.com>
Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit 0bc4518f3b)

Co-authored-by: Jonathan Piron <jonathan@piron.at>
This commit is contained in:
patchback[bot] 2021-10-04 21:41:59 +02:00 committed by GitHub
parent e4212472e2
commit 31d62c5947
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- gitlab_deploy_key - fix idempotency on projects with multiple deploy keys (https://github.com/ansible-collections/community.general/pull/3473).

View file

@ -204,7 +204,7 @@ class GitLabDeployKey(object):
@param key_title Title of the key @param key_title Title of the key
''' '''
def findDeployKey(self, project, key_title): def findDeployKey(self, project, key_title):
deployKeys = project.keys.list() deployKeys = project.keys.list(all=True)
for deployKey in deployKeys: for deployKey in deployKeys:
if (deployKey.title == key_title): if (deployKey.title == key_title):
return deployKey return deployKey