SCM inventory cancel propagation

For manually initiated inventory updates, also cancel the source
project of "sync" type, like jobs do

For automatic inventory updates spawned from source project update,
of launch type "scm", handle contigency cases
This commit is contained in:
AlanCoding
2017-05-09 09:42:53 -04:00
parent 55c2f5a2d6
commit 04d6fb1f95
4 changed files with 48 additions and 1 deletions

View File

@@ -501,6 +501,13 @@ class ProjectUpdate(UnifiedJob, ProjectOptions, JobNotificationMixin):
update_fields.append('scm_delete_on_next_update')
parent_instance.save(update_fields=update_fields)
def cancel(self, job_explanation=None):
res = super(ProjectUpdate, self).cancel(job_explanation=job_explanation)
if res and self.launch_type != 'sync':
for inv_src in self.scm_inventory_updates.filter(status='running'):
inv_src.cancel(job_explanation='Source project update `{}` was canceled.'.format(self.name))
return res
'''
JobNotificationMixin
'''