Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: HTTP 500 from "List cluster Azure resource" Geneva Action for unknown resource types #1978

Merged
merged 3 commits into from
Feb 24, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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