added aim
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
class VariableViewer:
|
||||
def __init__(self, customers):
|
||||
self.customers = customers
|
||||
|
||||
def files(self, customer: str, kind: str) -> list[Path]:
|
||||
if kind not in {"group_vars", "host_vars"}:
|
||||
raise ValueError("Unsupported variable directory")
|
||||
root = self.customers.require(customer) / kind
|
||||
if not root.exists():
|
||||
return []
|
||||
return sorted(p for p in root.rglob("*.yml") if p.is_file())
|
||||
|
||||
def relative(self, customer: str, path: Path) -> Path:
|
||||
return path.relative_to(self.customers.require(customer))
|
||||
Reference in New Issue
Block a user