gitlabform: Setting deploy key in some cases fail with HTTP 400: {"fingerprint":["has already been taken"]}
For further investigation:
* [215/420] Processing: internal_apps/watchdog
+++ Error while processing 'internal_apps/watchdog'
Traceback (most recent call last):
File "/srv/gitlab_tools/venv/lib64/python3.5/site-packages/gitlabform/gitlabform/core.py", line 211, in process_all
self.process_deploy_keys(project_and_group, configuration)
File "/srv/gitlab_tools/venv/lib64/python3.5/site-packages/gitlabform/gitlabform/core.py", line 31, in method_wrapper
return method(self, project_and_group, configuration)
File "/srv/gitlab_tools/venv/lib64/python3.5/site-packages/gitlabform/gitlabform/core.py", line 235, in process_deploy_keys
self.gl.post_deploy_key(project_and_group, configuration['deploy_keys'][deploy_key])
File "/srv/gitlab_tools/venv/lib64/python3.5/site-packages/gitlabform/gitlab/projects.py", line 40, in post_deploy_key
self._make_requests_to_api("projects/%s/deploy_keys", pid, 'POST', deploy_key, expected_codes=201)
File "/srv/gitlab_tools/venv/lib64/python3.5/site-packages/gitlabform/gitlab/core.py", line 47, in _make_requests_to_api
response = self._make_request_to_api(path_as_format_string, args, method, data, expected_codes)
File "/srv/gitlab_tools/venv/lib64/python3.5/site-packages/gitlabform/gitlab/core.py", line 83, in _make_request_to_api
raise e
gitlabform.gitlab.core.UnexpectedResponseException: Request url='https://xxx/api/v3/projects/1144/deploy_keys', method=POST, data='{'key': 'ssh-ed25519 yyyyyyyyyyy build@xxx.com', 'can_push': True, 'title': 'build@xxx.com auto-bump key'}' failed - expected code(s) 201, got code 400 & body: 'b'{"message":{"fingerprint":["has already been taken"]}}''
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 1
- Comments: 18 (11 by maintainers)
Commits related to this issue
- Reproduce bug #19 (thx jpiron) — committed to gitlabform/gitlabform by gdubicki 2 years ago
- Reproduce bug #19 (thx jpiron) — committed to gitlabform/gitlabform by gdubicki 2 years ago
- Reproduce bug #19 (thx jpiron) — committed to gitlabform/gitlabform by gdubicki 2 years ago
- Reproduce bug #19 (thx jpiron) — committed to gitlabform/gitlabform by gdubicki 2 years ago
- Reproduce bug #19 (thx jpiron) — committed to gitlabform/gitlabform by gdubicki 2 years ago
- Reproduce bug #19 (thx jpiron) — committed to gitlabform/gitlabform by gdubicki 2 years ago
- Reproduce bug #19 (thx jpiron) — committed to gitlabform/gitlabform by gdubicki 2 years ago
- Merge pull request #441 from gitlabform/fix_19 Fix #19 — committed to tmeijn/gitlabform by gdubicki 2 years ago
The fix in v3.3.1 resolves the issue for me. Please try it out and let me know about your results!
Had the same issue configuring a deploy key through the API. Basically we were adding the same key twice and the second addition was failing with this error. It turns out the issue came from the comment part of the key that was containing spaces (e.g:
ssh-rsa xxx== coment with spaces) Removing the key’s comment before adding it solved the issue.