fixed hostgroup create error
This commit is contained in:
parent
cda9df9e13
commit
3109229061
@ -140,10 +140,10 @@ def hostgroup_create(req: Request, name: str, params: HostgroupParams):
|
||||
|
||||
print("[DEBUG] hostgroup_create: creating hostgroup hierarchy with {} label(s): {}".format(len(labels), labels))
|
||||
|
||||
stmt = select(Host).where(and_(Host.name == bindparam('name'), Host.is_hostgroup == True, Host.parent_id == bindparam('last')))
|
||||
last = None
|
||||
for label in labels:
|
||||
result = db.execute(stmt, {'name': label, 'last': last}).fetchall()
|
||||
stmt = select(Host).where(and_(Host.name == label, Host.is_hostgroup == True, Host.parent_id == last))
|
||||
result = db.execute(stmt).fetchall()
|
||||
|
||||
if len(result) == 1:
|
||||
# simply step down through the hierarchy
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user