Skip to content

Commit

Permalink
bugfix: resolve issue with no-deadline context when listing RPs
Browse files Browse the repository at this point in the history
  • Loading branch information
manicminer committed Nov 29, 2023
1 parent 8bbe4e6 commit da00dc3
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions internal/clients/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"context"
"fmt"
"log"
"time"

"github.com/hashicorp/go-azure-helpers/authentication"
"github.com/hashicorp/go-azure-helpers/resourcemanager/commonids"
Expand Down Expand Up @@ -167,8 +168,11 @@ func Build(ctx context.Context, builder ClientBuilder) (*Client, error) {
if features.EnhancedValidationEnabled() {
subscriptionId := commonids.NewSubscriptionID(client.Account.SubscriptionId)

location.CacheSupportedLocations(ctx, *resourceManagerEndpoint)
if err := resourceproviders.CacheSupportedProviders(ctx, client.Resource.ResourceProvidersClient, subscriptionId); err != nil {
ctx2, cancel := context.WithTimeout(ctx, 10*time.Minute)
defer cancel()

location.CacheSupportedLocations(ctx2, *resourceManagerEndpoint)
if err := resourceproviders.CacheSupportedProviders(ctx2, client.Resource.ResourceProvidersClient, subscriptionId); err != nil {
log.Printf("[DEBUG] error retrieving providers: %s. Enhanced validation will be unavailable", err)
}
}
Expand Down

0 comments on commit da00dc3

Please sign in to comment.