clan-cli: cmd.py uses pseudo terminal now. Remove tty.py. Refactor password_store.py to use cmd.py.

This commit is contained in:
Qubasa
2024-06-02 16:52:31 +02:00
parent 0b34c340fc
commit ba86b49952
5 changed files with 84 additions and 86 deletions

View File

@@ -2,7 +2,7 @@ import os
import subprocess
from pathlib import Path
from clan_cli.cmd import Log, run
from clan_cli.cmd import run
from clan_cli.machines.machines import Machine
from clan_cli.nix import nix_shell
@@ -16,14 +16,13 @@ class SecretStore(SecretStoreBase):
def set(
self, service: str, name: str, value: bytes, groups: list[str]
) -> Path | None:
run(
subprocess.run(
nix_shell(
["nixpkgs#pass"],
["pass", "insert", "-m", f"machines/{self.machine.name}/{name}"],
),
input=value,
log=Log.BOTH,
error_msg=f"Failed to insert secret {name}",
check=True,
)
return None # we manage the files outside of the git repo