Updating dependency check for jobs, project updates, and inventory updates

This commit is contained in:
Matthew Jones
2014-03-31 17:15:38 -04:00
parent 034a5c7044
commit 4a535e5404
3 changed files with 9 additions and 7 deletions

View File

@@ -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

View File

@@ -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:

View File

@@ -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