mirror of https://github.com/k3s-io/k3s
Fix nil pointer dereference in test framework
Checking the result.Code prior to err in the if statement causes a panic if result is nil. It turns out the formatting of the error is already in IssueSSHCommandWithResult, so removing redundant code is enough to fix the issue. Logging the SSH result was also redundant, so I removed that as well.pull/6/head
parent
cbd87c3a13
commit
f789ecdcaf
|
@ -3550,16 +3550,10 @@ func IssueSSHCommandWithResult(cmd, provider string, node *v1.Node) (*SSHResult,
|
|||
}
|
||||
|
||||
func IssueSSHCommand(cmd, provider string, node *v1.Node) error {
|
||||
result, err := IssueSSHCommandWithResult(cmd, provider, node)
|
||||
if result != nil {
|
||||
LogSSHResult(*result)
|
||||
_, err := IssueSSHCommandWithResult(cmd, provider, node)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if result.Code != 0 || err != nil {
|
||||
return fmt.Errorf("failed running %q: %v (exit code %d)",
|
||||
cmd, err, result.Code)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue