Skip to content

Commit 3ae0e3f

Browse files
author
Ran Vaknin
committed
added logLevel check
1 parent 394d04f commit 3ae0e3f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

aws/ec2metadata/token_provider.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package ec2metadata
22

33
import (
44
"fmt"
5+
"github.com/aws/aws-sdk-go/aws"
56
"net/http"
67
"sync/atomic"
78
"time"
@@ -65,7 +66,9 @@ func (t *tokenProvider) fetchTokenHandler(r *request.Request) {
6566
switch requestFailureError.StatusCode() {
6667
case http.StatusForbidden, http.StatusNotFound, http.StatusMethodNotAllowed:
6768
atomic.StoreUint32(&t.disabled, 1)
68-
t.client.Config.Logger.Log(fmt.Sprintf("WARN: failed to get session token, falling back to IMDSv1: %v", requestFailureError))
69+
if t.client.Config.LogLevel.Matches(aws.LogDebugWithDeprecated) {
70+
t.client.Config.Logger.Log(fmt.Sprintf("WARN: failed to get session token, falling back to IMDSv1: %v", requestFailureError))
71+
}
6972
case http.StatusBadRequest:
7073
r.Error = requestFailureError
7174
}

0 commit comments

Comments
 (0)