Skip to content

Commit f413087

Browse files
Merge pull request #1333 from wking/can-mint-short-circuit
pkg/asset/installconfig/aws/permissions: If we can mint, skip passthrough check
2 parents 7456cf2 + e8b463b commit f413087

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

pkg/asset/installconfig/aws/permissions.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -211,17 +211,19 @@ func ValidateCreds(ssn *session.Session) error {
211211
if err != nil {
212212
return errors.Wrap(err, "mint credentials check")
213213
}
214+
if canMint {
215+
return nil
216+
}
214217

215218
// Check whether we can use the current credentials in passthrough mode to satisfy
216219
// cluster services needing to interact with the cloud
217220
canPassthrough, err := credvalidator.CheckCloudCredPassthrough(client, logger)
218221
if err != nil {
219222
return errors.Wrap(err, "passthrough credentials check")
220223
}
221-
222-
if !canMint && !canPassthrough {
223-
return errors.New("AWS credentials cannot be used to either create new creds or use as-is")
224+
if canPassthrough {
225+
return nil
224226
}
225227

226-
return nil
228+
return errors.New("AWS credentials cannot be used to either create new creds or use as-is")
227229
}

0 commit comments

Comments
 (0)