From 9f3a0c071697ef395e53fd4190d53f5d73f14864 Mon Sep 17 00:00:00 2001 From: Matthew Jones Date: Tue, 12 Sep 2017 09:42:50 -0400 Subject: [PATCH] Fix an issue where dependent updates weren't sorted correctly When considering previous / current Project Updates we weren't properly sorting the previous runs. We also make sure we filter down to just "check" style project updates and don't consider 'run' style standalone project updates when deciding what are potentially related project updates --- awx/main/scheduler/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/awx/main/scheduler/__init__.py b/awx/main/scheduler/__init__.py index 670012dc57..549f1546f3 100644 --- a/awx/main/scheduler/__init__.py +++ b/awx/main/scheduler/__init__.py @@ -300,7 +300,7 @@ class TaskManager(): # Already processed dependencies for this job if job.dependent_jobs.all(): return False - latest_inventory_update = InventoryUpdate.objects.filter(inventory_source=inventory_source).order_by("created") + latest_inventory_update = InventoryUpdate.objects.filter(inventory_source=inventory_source).order_by("-created") if not latest_inventory_update.exists(): return True latest_inventory_update = latest_inventory_update.first() @@ -323,7 +323,7 @@ class TaskManager(): now = tz_now() if job.dependent_jobs.all(): return False - latest_project_update = ProjectUpdate.objects.filter(project=job.project).order_by("created") + latest_project_update = ProjectUpdate.objects.filter(project=job.project, job_type='check').order_by("-created") if not latest_project_update.exists(): return True latest_project_update = latest_project_update.first()