hashicorp / nomad

Nomad is an easy-to-use, flexible, and performant workload orchestrator that can deploy a mix of microservice, batch, containerized, and non-containerized applications. Nomad is easy to operate and scale and has native Consul and Vault integrations.
https://www.nomadproject.io/
Other
14.98k stars 1.96k forks source link

Backport of consul: handle nil multierror pointer correctly into release/1.9.x #24516

Closed hc-github-team-nomad-core closed 5 days ago

hc-github-team-nomad-core commented 5 days ago

Backport

This PR is auto-generated from #24513 to be assessed for backporting due to the inclusion of the label backport/1.9.x.

The below text is copied from the body of the original PR.


When the service client syncs to Consul, we accumulate service sync errors in a multierror before reading all the local checks. If the API call to the local checks fails, we either return that error or append it to the multierror and return the set of errors. But multierror.Error.Len() doesn't nil-check, so we need to do this ourselves.

I've also made a quick pass through the rest of the code base looking for multierror Len method calls to see if we have this pattern elsewhere.

Fixes: https://github.com/hashicorp/nomad/issues/24512


Overview of commits - 6b9dbefb9ed4b51394218ba8fdc4eee9959d416b