mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-06 02:54:26 +00:00
fix(vault): encrypt_string reads plaintext from stdin so leading-dash values encrypt
This commit is contained in:
1 parent
257cfc0491
commit
052cea02e2
1 file changed
+5
-3
@@ -34,12 +34,14 @@ class VaultHandler:
|
||||
cmd = [
|
||||
"ansible-vault",
|
||||
"encrypt_string",
|
||||
value,
|
||||
f"--name={name}",
|
||||
"--stdin-name",
|
||||
name,
|
||||
"--vault-password-file",
|
||||
self.vault_password_file,
|
||||
]
|
||||
proc = subprocess.run(cmd, capture_output=True, text=True, check=False)
|
||||
proc = subprocess.run(
|
||||
cmd, input=value, capture_output=True, text=True, check=False
|
||||
)
|
||||
if proc.returncode != 0:
|
||||
raise RuntimeError(f"ansible-vault encrypt_string failed:\n{proc.stderr}")
|
||||
return proc.stdout
|
||||
|
||||
Reference in new issue
Block a user