Skip to content

Commit 3d5e59c

Browse files
committed
fix: Regenerate existing AerleonPolicies
1 parent 8ab427b commit 3d5e59c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

nautobot_firewall_models/jobs.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@ def run(self, devices, virtual_machines): # pylint: disable=arguments-differ
5050
for obj in objects:
5151
logger.debug("Running: `%s`", str(obj))
5252
content_type = ContentType.objects.get_for_model(obj)
53-
AerleonPolicy.objects.update_or_create(content_type=content_type, object_id=obj.id)
53+
policy, _ = AerleonPolicy.objects.get_or_create(content_type=content_type, object_id=obj.id)
54+
# Note: We explicitly have to save the policy to make sure the content of the AerleonPolicy gets regenerated.
55+
policy.save()
5456
logger.info("%s Updated", obj, extra={"object": obj})
5557

5658

0 commit comments

Comments
 (0)