Skip to content

Commit c486a6f

Browse files
authored
Merge pull request #777 from kanwren/kanwren/fix-credential-caching-error
Fix credential expirability check
2 parents 0d2289b + 4b9d665 commit c486a6f

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

pkg/filecache/converter.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ func (p *v2) Retrieve(ctx context.Context) (aws.Credentials, error) {
2727
// Don't have account ID
2828
}
2929

30-
if expiration, err := p.creds.ExpiresAt(); err != nil {
30+
if expiration, err := p.creds.ExpiresAt(); err == nil {
3131
resp.CanExpire = true
3232
resp.Expires = expiration
3333
}

pkg/filecache/filecache.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,8 +251,7 @@ func (f *FileCacheProvider) RetrieveWithContext(ctx context.Context) (credential
251251
}
252252
} else {
253253
// credential doesn't support expiration time, so can't cache, but still return the credential
254-
_, _ = fmt.Fprintf(os.Stderr, "Unable to cache credential: %v\n", err)
255-
err = nil
254+
_, _ = fmt.Fprint(os.Stderr, "Unable to cache credential: credential doesn't support expiration\n")
256255
}
257256
return V2CredentialToV1Value(credential), err
258257
}

0 commit comments

Comments
 (0)