Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix configured ansible-vault-ids getting removed on buffer kill (#29) #30

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions ansible-vault.el
Original file line number Diff line number Diff line change
Expand Up @@ -294,13 +294,14 @@ PASSWORD-FILE path to the stored secret for provided VAULT-ID."
(defun ansible-vault--flush-vault-id ()
"Delete vault-id pair and associated buffer local variables."
(when ansible-vault--vault-id
(when (map-contains-key ansible-vault-vault-id-alist ansible-vault--vault-id)
(setq ansible-vault-vault-id-alist
(map-filter (lambda (key _)
(not (string= key ansible-vault--vault-id)))
ansible-vault-vault-id-alist)))
(setq-local ansible-vault--vault-id nil)
(ansible-vault--flush-password-file)))
(let ((vault-id-pair (assoc ansible-vault--vault-id ansible-vault-vault-id-alist)))
(when (member (cdr vault-id-pair) ansible-vault--password-file-list)
(setq ansible-vault-vault-id-alist
(map-filter (lambda (key _)
(not (string= key ansible-vault--vault-id)))
ansible-vault-vault-id-alist))
(setq-local ansible-vault--vault-id nil)
(ansible-vault--flush-password-file)))))

(defun ansible-vault--error-buffer ()
"Generate or return `ansible-vaul't error report buffer."
Expand Down