Skip to content

Commit

Permalink
fix: HTTP 500 from "List cluster Azure resource" Geneva Action for un…
Browse files Browse the repository at this point in the history
…known resource types (#1978)

* If don't have an apiVersion defined for a resource, then skip over it instead of returning an error.

* Reword the comment.

* Double quote the resource type in the log warning message.

Co-authored-by: Mikalai Radchuk <[email protected]>
  • Loading branch information
darthhexx and m1kola authored Feb 24, 2022
1 parent ce39aa0 commit 89e051b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pkg/frontend/adminactions/resources_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ package adminactions
import (
"context"
"encoding/json"
"fmt"

mgmtcompute "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2020-06-01/compute"
"github.com/Azure/go-autorest/autorest/azure"
Expand Down Expand Up @@ -39,7 +38,11 @@ func (a *azureActions) ResourcesList(ctx context.Context) ([]byte, error) {
for _, res := range resources {
apiVersion := azureclient.APIVersion(*res.Type)
if apiVersion == "" {
return nil, fmt.Errorf("API version not found for type %s", *res.Type)
// If custom resource types, or any we don't have listed in pkg/util/azureclient/apiversions.go,
// are returned, then skip over them instead of returning an error, otherwise it results in an
// HTTP 500 and prevents the known resource types from being returned.
a.log.Warnf("API version not found for type %q", *res.Type)
continue
}
switch *res.Type {
case "Microsoft.Compute/virtualMachines":
Expand Down

0 comments on commit 89e051b

Please sign in to comment.