Skip to content

Commit 2fe9f76

Browse files
authored
Only try to use token from kubeconfig for machine console. (#259)
This mitigates an issue when trying to console access machines without a preceding metalctl login (e.g. when only using HMAC auth). The console access might still work in case the proper identity was passed.
1 parent 5e1a339 commit 2fe9f76

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

cmd/machine.go

+5-3
Original file line numberDiff line numberDiff line change
@@ -1280,12 +1280,14 @@ func (c *machineCmd) machineConsole(args []string) error {
12801280
if err != nil {
12811281
return err
12821282
}
1283+
1284+
var token string
12831285
authContext, err := getAuthContext(viper.GetString("kubeconfig"))
1284-
if err != nil {
1285-
return err
1286+
if err == nil {
1287+
token = authContext.IDToken
12861288
}
12871289

1288-
err = sshClient(id, viper.GetString("sshidentity"), parsedurl.Host, bmcConsolePort, &authContext.IDToken, viper.GetBool("admin"))
1290+
err = sshClient(id, viper.GetString("sshidentity"), parsedurl.Host, bmcConsolePort, &token, viper.GetBool("admin"))
12891291
if err != nil {
12901292
return fmt.Errorf("machine console error:%w", err)
12911293
}

0 commit comments

Comments
 (0)