From bf5b9b835f1f5c8726cbae8e87a6f2325ab3ce5d Mon Sep 17 00:00:00 2001 From: Mario Manno Date: Thu, 22 Apr 2021 13:19:12 +0200 Subject: [PATCH] Remove proccess-less jobs from drain stamp count Also exit outer-loop early if nothing to add. --- pkg/bosh/bpmconverter/containers.go | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/pkg/bosh/bpmconverter/containers.go b/pkg/bosh/bpmconverter/containers.go index 77b9bb6eb..df6ce5865 100644 --- a/pkg/bosh/bpmconverter/containers.go +++ b/pkg/bosh/bpmconverter/containers.go @@ -29,7 +29,17 @@ func (c *ContainerFactoryImpl) JobsToContainers( } // wait for that many drain stamps to appear - drainStampCount := strconv.Itoa(len(jobs)) + n := 0 + for _, job := range jobs { + bpmConfig, ok := c.bpmConfigs[job.Name] + if !ok { + return nil, errors.Errorf("failed to lookup bpm config for bosh job '%s' in bpm configs", job.Name) + } + if len(bpmConfig.Processes) > 0 { + n++ + } + } + drainStampCount := strconv.Itoa(n) // each job can produce multiple BPM process containers for _, job := range jobs { @@ -42,6 +52,10 @@ func (c *ContainerFactoryImpl) JobsToContainers( if !ok { return nil, errors.Errorf("failed to lookup bpm config for bosh job '%s' in bpm configs", job.Name) } + if len(bpmConfig.Processes) < 1 { + // we won't create any containers for this job + continue + } jobDisks := bpmDisks.Filter("job_name", job.Name)