Browse Source

Backport of fix(peering): nil pointer in calling handleUpdateService into release/1.14.x (#15162)

This pull request was automerged via backport-assistant
pull/15171/head
hc-github-team-consul-core 2 years ago committed by GitHub
parent
commit
8e7e929875
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      .changelog/15160.txt
  2. 10
      agent/grpc-external/services/peerstream/replication.go

3
.changelog/15160.txt

@ -0,0 +1,3 @@
```release-note:bug
peering: fix nil pointer in calling handleUpdateService
```

10
agent/grpc-external/services/peerstream/replication.go vendored

@ -287,7 +287,6 @@ func (s *Server) handleUpsertExportedServiceList(
if err != nil {
return err
}
for _, sn := range serviceList {
if _, ok := exportedServices[sn]; !ok {
err := s.handleUpdateService(peerName, partition, sn, nil)
@ -324,9 +323,12 @@ func (s *Server) handleUpdateService(
return fmt.Errorf("failed to read imported services: %w", err)
}
structsNodes, err := export.CheckServiceNodesToStruct()
if err != nil {
return fmt.Errorf("failed to convert protobuf instances to structs: %w", err)
structsNodes := []structs.CheckServiceNode{}
if export != nil {
structsNodes, err = export.CheckServiceNodesToStruct()
if err != nil {
return fmt.Errorf("failed to convert protobuf instances to structs: %w", err)
}
}
// Normalize the data into a convenient form for operation.

Loading…
Cancel
Save