Repository navigation
[PR #13132/f7b4249f backport][stable-11] github_deploy_key: do not delete the key with state=absent in check mode - #13161
Merged
felixfontein merged 4 commits intoOct 30, 2026
Conversation
…ode (#13132) * github_deploy_key: do not delete the key with state=absent in check mode Fixes #12348. Assisted-by: Grok Bot * github_deploy_key: only return id in check mode when the key exists Match the non-check-mode result for state=absent: return id and the 'Deploy key successfully deleted' message only when a key would be removed, and 'Deploy key does not exist' otherwise. Add the PR link to the changelog fragment. (cherry picked from commit f7b4249)
Collaborator
felixfontein
deleted the
patchback/backports/stable-11/f7b4249fffef6563ada9be3de076ef0a095bc3b2/pr-13132
branch
October 30, 2026 21:25
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a backport of PR #13132 as merged into main (f7b4249).
SUMMARY
github_deploy_keywithstate: absentdeleted an existing deploy key even in check mode. The check-mode block inmain()only handledstate: present, so forstate: absentexecution fell through toremove_existing_key()and sent theDELETErequest.In check mode with
state: absent, the module now only looks up the key and reportschanged: trueif it exists (with itsid) orchanged: falseif it doesn't, without calling the API'sDELETEendpoint.Fixes #12348
Assisted-by: Grok Bot (AI assistant); I reviewed and tested the change.
ISSUE TYPE
COMPONENT NAME
github_deploy_key
ADDITIONAL INFORMATION
Added
tests/unit/plugins/modules/test_github_deploy_key.py(mocksfetch_url):changed=True, only aGETis sent (this test fails onmainbecause aDELETEis issued)changed=False, noDELETE/keys/<id>