Skip to content

Commit

Permalink
Always apply dynamic group filters
Browse files Browse the repository at this point in the history
Dynamic Groups of type dynamic-set have an empty filter, and were not being applied previously
  • Loading branch information
johanek committed Oct 22, 2024
1 parent 16f9a3c commit f0e6ac5
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions nautobot_golden_config/utilities/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,8 @@ def get_job_filter(data=None):
query.update({"id": data["device"].values_list("pk", flat=True)})

raw_qs = Q()
# If scope is set to {} do not loop as all devices are in scope.
if not models.GoldenConfigSetting.objects.filter(dynamic_group__filter__iexact="{}").exists():
for obj in models.GoldenConfigSetting.objects.all():
raw_qs = raw_qs | obj.dynamic_group.generate_query()
for obj in models.GoldenConfigSetting.objects.all():
raw_qs = raw_qs | obj.dynamic_group.generate_query()

base_qs = Device.objects.filter(raw_qs)

Expand Down

0 comments on commit f0e6ac5

Please sign in to comment.