Compare commits

...

2 Commits

Author SHA1 Message Date
12237e8ec7 Merge branch 'main' of gitea.linvogel.ch:linus/PillarTool 2026-05-12 21:55:22 +02:00
74ec95fd9f fixed adding hosts 2026-05-12 21:55:16 +02:00

View File

@ -130,12 +130,9 @@ async def host_add(request: Request, fqdn: str, params: HostCreateParams):
# Traverse the parent hierarchy to ensure all components exist # Traverse the parent hierarchy to ensure all components exist
parent_id = None parent_id = None
stmt_select_respecting_parent = select(Host).where(and_(Host.name == bindparam("label"), Host.parent_id == bindparam("parent_id")))
for label in parent_labels: for label in parent_labels:
result = db.execute(stmt_select_respecting_parent, { stmt_select_respecting_parent = select(Host).where(and_(Host.name == label, Host.parent_id == parent_id))
'label': label, result = db.execute(stmt_select_respecting_parent).fetchall()
'parent_id': parent_id
}).fetchall()
if len(result) == 0: if len(result) == 0:
raise HTTPException(status_code=400, detail="Parent does not exist") raise HTTPException(status_code=400, detail="Parent does not exist")