Skip to content

Commit

Permalink
fix(manager): fix inventory filters query
Browse files Browse the repository at this point in the history
  • Loading branch information
Tomáš Sasák authored and jdobes committed Oct 18, 2023
1 parent 6fbba8f commit cad9376
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions manager/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,7 @@ def _filter_inventory_group_names(query, args, _kwargs):
object: Modified query with Inventory Group name filter applied
"""
if names := args.get("group_names"):
expr = Expression(InventoryHosts.groups, "@>", fn.ANY(SQL(f"'{names}'::jsonb[]")))
expr = Expression(InventoryHosts.groups, "@>", fn.ANY(SQL("%s::jsonb[]", (names,))))
query = query.where(expr)
return query

Expand All @@ -627,7 +627,7 @@ def _filter_inventory_group_ids(query, args, _kwargs):
object: Modified query with Inventory Group name filter applied
"""
if ids := args.get("group_ids"):
expr = Expression(InventoryHosts.groups, "@>", fn.ANY(SQL(f"'{ids}'::jsonb[]")))
expr = Expression(InventoryHosts.groups, "@>", fn.ANY(SQL("%s::jsonb[]", (ids,))))
query = query.where(expr)
return query

Expand Down

0 comments on commit cad9376

Please sign in to comment.