clan-core/pkgs/clan-cli/clan_cli/machines/facts.py
lassulus 1ea13646ea
Some checks failed
checks / test (pull_request) Failing after 1m7s
checks-impure / test (pull_request) Successful in 1m31s
clan_cli: flake_name -> flake_dir
2023-11-15 16:23:28 +01:00

12 lines
376 B
Python

from pathlib import Path
from ..dirs import specific_machine_dir
def machine_has_fact(flake_dir: Path, machine: str, fact: str) -> bool:
return (specific_machine_dir(flake_dir, machine) / "facts" / fact).exists()
def machine_get_fact(flake_dir: Path, machine: str, fact: str) -> str:
return (specific_machine_dir(flake_dir, machine) / "facts" / fact).read_text()