Compare commits

..

3 Commits
v0.4 ... main

Author SHA1 Message Date
fe5ee5bd4d more explicit typing when decoding 2026-06-18 22:53:53 +02:00
4c649f90bc fixed for real 2026-06-18 22:45:33 +02:00
2c69cab5d5 fixed parsing of non-primitive pillars 2026-06-18 22:11:30 +02:00
2 changed files with 8 additions and 8 deletions

View File

@ -13,12 +13,12 @@ def get_pillar_name_sequence(name: str) -> list[str]:
def decode_pillar_value(pillar: Pillar) -> str | int | float | bool | list | dict: def decode_pillar_value(pillar: Pillar) -> str | int | float | bool | list | dict:
match pillar.parameter_type: match pillar.parameter_type:
case 'string': return str(pillar.value) case 'string': return str(json.loads(pillar.value))
case 'integer': return int(pillar.value) case 'integer': return int(json.loads(pillar.value))
case 'float': return float(pillar.value) case 'float': return float(json.loads(pillar.value))
case 'boolean': return bool(pillar.value) case 'boolean': return bool(json.loads(pillar.value))
case 'list': return json.loads(pillar.value) case 'list': return list(json.loads(pillar.value))
case 'dict': return json.loads(pillar.value) case 'dict': return dict(json.loads(pillar.value))
raise RuntimeError(f"Failed to decode pillar value: Invalid type '{pillar.parameter_type}'") raise RuntimeError(f"Failed to decode pillar value: Invalid type '{pillar.parameter_type}'")
@ -43,6 +43,6 @@ def get_pillar_for_target(db: Session, target: UUID) -> dict:
current[label] = {} current[label] = {}
current = current[label] current = current[label]
else: else:
current[label] = json.loads(str(value)) current[label] = value
return out return out

View File

@ -1,6 +1,6 @@
[project] [project]
name = "pillartool" name = "pillartool"
version = "0.1.0" version = "0.6.0"
description = "Add your description here" description = "Add your description here"
requires-python = ">=3.13" requires-python = ">=3.13"
dependencies = [ dependencies = [