Merge pull request #2792 from AlanCoding/how_many_slices

Prohibit relaunching sliced jobs with changed count

Reviewed-by: https://github.com/softwarefactory-project-zuul[bot]
This commit is contained in:
softwarefactory-project-zuul[bot] 2018-11-29 15:57:40 +00:00 committed by GitHub
commit 349c7efa69
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3140,8 +3140,11 @@ class WorkflowJobRelaunch(WorkflowsEnforcementMixin, GenericAPIView):
def post(self, request, *args, **kwargs):
obj = self.get_object()
if obj.is_sliced_job and not obj.job_template_id:
raise ParseError(_('Cannot relaunch slice workflow job orphaned from job template.'))
if obj.is_sliced_job:
if not obj.job_template_id:
raise ParseError(_('Cannot relaunch slice workflow job orphaned from job template.'))
elif obj.job_template.job_slice_count != obj.workflow_nodes.count():
raise ParseError(_('Cannot relaunch sliced workflow job after slice count has changed.'))
new_workflow_job = obj.create_relaunch_workflow_job()
new_workflow_job.signal_start()