diff --git a/awx/main/models/inventory.py b/awx/main/models/inventory.py index beeb5ec878..734cd002f8 100644 --- a/awx/main/models/inventory.py +++ b/awx/main/models/inventory.py @@ -724,10 +724,11 @@ class InventoryUpdate(UnifiedJob, InventorySourceOptions): return reverse('api:inventory_update_detail', args=(self.pk,)) def is_blocked_by(self, obj): - # FIXME: Block update when any other update is touching the same inventory! - # FIXME: Block update when any job is running using this inventory! if type(obj) == InventoryUpdate: - if self.inventory_source == obj.inventory_source: + if self.inventory_source.inventory == obj.inventory_source.inventory: + return True + if type(obj) == Job: + if self.inventory_source.inventory == obj.inventory: return True return False diff --git a/awx/main/models/jobs.py b/awx/main/models/jobs.py index 87c5ec2f0a..25a5e4f0ce 100644 --- a/awx/main/models/jobs.py +++ b/awx/main/models/jobs.py @@ -256,9 +256,8 @@ class Job(UnifiedJob, JobOptions): return True return False if type(obj) == InventoryUpdate: - for i_s in self.inventory.inventory_sources.filter(active=True): - if i_s == obj.inventory_source: - return True + if self.inventory == obj.inventory_source.inventory: + return True return False if type(obj) == ProjectUpdate: if obj.project == self.project: diff --git a/awx/main/models/projects.py b/awx/main/models/projects.py index aa65d5153f..ecd94e21d2 100644 --- a/awx/main/models/projects.py +++ b/awx/main/models/projects.py @@ -334,10 +334,12 @@ class ProjectUpdate(UnifiedJob, ProjectOptions): return RunProjectUpdate def is_blocked_by(self, obj): - # FIXME: Block update when any job is running using this project! if type(obj) == ProjectUpdate: if self.project == obj.project: return True + if type(obj) == Job: + if self.project == obj.project: + return True return False @property