fix(vault): encrypt_string reads plaintext from stdin so leading-dash values encrypt

This commit is contained in:
kevinveenbirkenbach committed 2026-06-14 10:01:28 +02:00
1 parent 257cfc0491
commit 052cea02e2
1 file changed
+5 -3
+5 -3
View File
@@ -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