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 task in check mode (#3622)

fixes #3621

* running check mode used to accidentally delete the existing
  ssh key; change it so deletion is skipped in check mode
This commit is contained in:
Waldek Maleska 2021-10-28 19:07:05 +01:00 committed by GitHub
parent 3a2f52c1db
commit 8ba7fd5d61
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 1 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- gitlab_deploy_key - fix the SSH Deploy Key being deleted accidentally while running task in check mode (https://github.com/ansible-collections/community.general/issues/3621, https://github.com/ansible-collections/community.general/pull/3622).

View file

@ -149,7 +149,8 @@ class GitLabDeployKey(object):
# GitLab REST API, so for that case we need to delete and # GitLab REST API, so for that case we need to delete and
# than recreate the key # than recreate the key
if self.deployKeyObject and self.deployKeyObject.key != key_key: if self.deployKeyObject and self.deployKeyObject.key != key_key:
self.deployKeyObject.delete() if not self._module.check_mode:
self.deployKeyObject.delete()
self.deployKeyObject = None self.deployKeyObject = None
# Because we have already call existsDeployKey in main() # Because we have already call existsDeployKey in main()