mirror of
https://github.com/ansible/awx.git
synced 2026-03-10 05:59:28 -02:30
Updating dependency check for jobs, project updates, and inventory updates
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user