Parcourir la source

Fixes /savings/orphanedResources end point failing with 500 internal server when its unable to read disk.description (#2920)

* fix /orphanedResources end point failing with 500 internal server when 1 particular orphaned disk description is unable to be read

Signed-off-by: Alan Rodrigues <alanr5691@yahoo.com>

* making it log.Errorf and also have similar error message as error

Signed-off-by: Alan Rodrigues <alanr5691@yahoo.com>

---------

Signed-off-by: Alan Rodrigues <alanr5691@yahoo.com>
Alan Rodrigues il y a 1 an
Parent
commit
805b231751
1 fichiers modifiés avec 2 ajouts et 1 suppressions
  1. 2 1
      pkg/cloud/gcp/provider.go

+ 2 - 1
pkg/cloud/gcp/provider.go

@@ -495,7 +495,8 @@ func (gcp *GCP) GetOrphanedResources() ([]models.OrphanedResource, error) {
 				desc := map[string]string{}
 				if disk.Description != "" {
 					if err := json.Unmarshal([]byte(disk.Description), &desc); err != nil {
-						return nil, fmt.Errorf("error converting string to map: %s", err)
+						log.Errorf("ignoring orphaned disk %s, failed to convert disk description to map: %s", disk.Name, err)
+						continue
 					}
 				}