Compare commits
2 Commits
2e61d4d789
...
12237e8ec7
| Author | SHA1 | Date | |
|---|---|---|---|
| 12237e8ec7 | |||
| 74ec95fd9f |
@ -130,12 +130,9 @@ 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:
|
||||
result = db.execute(stmt_select_respecting_parent, {
|
||||
'label': label,
|
||||
'parent_id': parent_id
|
||||
}).fetchall()
|
||||
stmt_select_respecting_parent = select(Host).where(and_(Host.name == label, Host.parent_id == parent_id))
|
||||
result = db.execute(stmt_select_respecting_parent).fetchall()
|
||||
|
||||
if len(result) == 0:
|
||||
raise HTTPException(status_code=400, detail="Parent does not exist")
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user