Compare commits
No commits in common. "12237e8ec7c80c2358a8102e82f16d64d509f994" and "2e61d4d78919dc1ed38365ba13965363c97b1c06" have entirely different histories.
12237e8ec7
...
2e61d4d789
@ -130,9 +130,12 @@ async def host_add(request: Request, fqdn: str, params: HostCreateParams):
|
||||
|
||||
# Traverse the parent hierarchy to ensure all components exist
|
||||
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:
|
||||
stmt_select_respecting_parent = select(Host).where(and_(Host.name == label, Host.parent_id == parent_id))
|
||||
result = db.execute(stmt_select_respecting_parent).fetchall()
|
||||
result = db.execute(stmt_select_respecting_parent, {
|
||||
'label': label,
|
||||
'parent_id': parent_id
|
||||
}).fetchall()
|
||||
|
||||
if len(result) == 0:
|
||||
raise HTTPException(status_code=400, detail="Parent does not exist")
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user