clan-core/pkgs/clan-cli/clan_cli/machines/facts.py

12 lines
376 B
Python
Raw Normal View History

2023-11-15 13:28:40 +00:00
from pathlib import Path
2023-10-24 14:54:10 +00:00
from ..dirs import specific_machine_dir
2023-11-15 13:28:40 +00:00
def machine_has_fact(flake_dir: Path, machine: str, fact: str) -> bool:
return (specific_machine_dir(flake_dir, machine) / "facts" / fact).exists()
2023-11-15 13:28:40 +00:00
def machine_get_fact(flake_dir: Path, machine: str, fact: str) -> str:
return (specific_machine_dir(flake_dir, machine) / "facts" / fact).read_text()