clan: fix clan facts list [MACHINE]

Fix `clan facts list [MACHINE]`.
The get command returned a dictionary of bytestrings.
We now convert them to strings.
This commit is contained in:
a-kenji
2024-05-26 14:26:08 +02:00
parent 998789f75e
commit ead8118713

View File

@@ -26,7 +26,14 @@ def get_all_facts(machine: Machine) -> dict:
def get_command(args: argparse.Namespace) -> None:
machine = Machine(name=args.machine, flake=args.flake)
print(json.dumps(get_all_facts(machine), indent=4))
# the raw_facts are bytestrings making them not json serializable
raw_facts = get_all_facts(machine)
facts = dict()
for key in raw_facts["TODO"]:
facts[key] = raw_facts["TODO"][key].decode("utf8")
print(json.dumps(facts, indent=4))
def register_list_parser(parser: argparse.ArgumentParser) -> None: