mirror of
https://github.com/ansible/awx.git
synced 2026-03-27 13:55:04 -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,))
|
return reverse('api:inventory_update_detail', args=(self.pk,))
|
||||||
|
|
||||||
def is_blocked_by(self, obj):
|
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 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 True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|||||||
@@ -256,9 +256,8 @@ class Job(UnifiedJob, JobOptions):
|
|||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
if type(obj) == InventoryUpdate:
|
if type(obj) == InventoryUpdate:
|
||||||
for i_s in self.inventory.inventory_sources.filter(active=True):
|
if self.inventory == obj.inventory_source.inventory:
|
||||||
if i_s == obj.inventory_source:
|
return True
|
||||||
return True
|
|
||||||
return False
|
return False
|
||||||
if type(obj) == ProjectUpdate:
|
if type(obj) == ProjectUpdate:
|
||||||
if obj.project == self.project:
|
if obj.project == self.project:
|
||||||
|
|||||||
@@ -334,10 +334,12 @@ class ProjectUpdate(UnifiedJob, ProjectOptions):
|
|||||||
return RunProjectUpdate
|
return RunProjectUpdate
|
||||||
|
|
||||||
def is_blocked_by(self, obj):
|
def is_blocked_by(self, obj):
|
||||||
# FIXME: Block update when any job is running using this project!
|
|
||||||
if type(obj) == ProjectUpdate:
|
if type(obj) == ProjectUpdate:
|
||||||
if self.project == obj.project:
|
if self.project == obj.project:
|
||||||
return True
|
return True
|
||||||
|
if type(obj) == Job:
|
||||||
|
if self.project == obj.project:
|
||||||
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
|||||||
Reference in New Issue
Block a user