mirror of
https://github.com/opentffoundation/opentf.git
synced 2025-12-25 01:00:16 -05:00
backend/oss: Ignore the getting oss endpoint error and using string concat instead; Improves the error message level
This commit is contained in:
@@ -4,7 +4,6 @@ import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"github.com/aliyun/alibaba-cloud-sdk-go/sdk/endpoints"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"net/http"
|
||||
@@ -16,6 +15,8 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/aliyun/alibaba-cloud-sdk-go/sdk/endpoints"
|
||||
|
||||
"github.com/aliyun/alibaba-cloud-sdk-go/sdk"
|
||||
"github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/credentials"
|
||||
"github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests"
|
||||
@@ -379,12 +380,13 @@ func (b *Backend) configure(ctx context.Context) error {
|
||||
if endpoint == "" {
|
||||
endpointsResponse, err := b.getOSSEndpointByRegion(accessKey, secretKey, securityToken, region)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
for _, endpointItem := range endpointsResponse.Endpoints.Endpoint {
|
||||
if endpointItem.Type == "openAPI" {
|
||||
endpoint = endpointItem.Endpoint
|
||||
break
|
||||
log.Printf("[WARN] getting oss endpoint failed and using oss-%s.aliyuncs.com instead. Error: %#v.", region, err)
|
||||
} else {
|
||||
for _, endpointItem := range endpointsResponse.Endpoints.Endpoint {
|
||||
if endpointItem.Type == "openAPI" {
|
||||
endpoint = endpointItem.Endpoint
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
if endpoint == "" {
|
||||
|
||||
Reference in New Issue
Block a user