Skip to content

Commit fb74b7e

Browse files
authored
Cache credentials immediately after they are read (#1400)
1 parent 8032cb7 commit fb74b7e

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

cli/cmd/cluster.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,8 @@ var _upCmd = &cobra.Command{
158158
exit.Error(err)
159159
}
160160

161+
cacheAWSCredentials(awsCreds, accessConfig)
162+
161163
clusterState, err := clusterstate.GetClusterState(awsClient, &accessConfig)
162164
if err != nil {
163165
exit.Error(err)
@@ -294,8 +296,6 @@ var _upCmd = &cobra.Command{
294296
exit.Error(errors.Append(err, fmt.Sprintf("unable to configure cli environment; you can attempt to resolve this issue and configure your CLI environment by running `cortex cluster info --env %s`", _flagClusterEnv)))
295297
}
296298

297-
cacheAWSCredentials(awsCreds, accessConfig)
298-
299299
fmt.Printf(console.Bold("\nan environment named \"%s\" has been configured for this cluster; append `--env %s` to cortex commands to connect to it (e.g. `cortex deploy --env %s`), or set it as your default with `cortex env default %s`\n"), _flagClusterEnv, _flagClusterEnv, _flagClusterEnv, _flagClusterEnv)
300300
},
301301
}
@@ -332,6 +332,8 @@ var _configureCmd = &cobra.Command{
332332
exit.Error(err)
333333
}
334334

335+
cacheAWSCredentials(awsCreds, *accessConfig)
336+
335337
awsClient, err := newAWSClient(*accessConfig.Region, awsCreds)
336338
if err != nil {
337339
exit.Error(err)
@@ -364,8 +366,6 @@ var _configureCmd = &cobra.Command{
364366
fmt.Println(helpStr)
365367
exit.Error(ErrorClusterConfigure(out + helpStr))
366368
}
367-
368-
cacheAWSCredentials(awsCreds, *accessConfig)
369369
},
370370
}
371371

@@ -400,13 +400,13 @@ var _infoCmd = &cobra.Command{
400400
exit.Error(err)
401401
}
402402

403+
cacheAWSCredentials(awsCreds, *accessConfig)
404+
403405
if _flagClusterInfoDebug {
404406
cmdDebug(awsCreds, accessConfig)
405407
} else {
406408
cmdInfo(awsCreds, accessConfig, _flagClusterDisallowPrompt)
407409
}
408-
409-
cacheAWSCredentials(awsCreds, *accessConfig)
410410
},
411411
}
412412

0 commit comments

Comments
 (0)