-
-
Notifications
You must be signed in to change notification settings - Fork 462
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] Image import exec failure logs are hidden #1171
Labels
bug
Something isn't working
Comments
The fix for this is to assign the error from reading the logs to its own variable: diff --git a/pkg/runtimes/docker/node.go b/pkg/runtimes/docker/node.go
index 5ea6d05d..c73efca2 100644
--- a/pkg/runtimes/docker/node.go
+++ b/pkg/runtimes/docker/node.go
@@ -352,8 +352,8 @@ func execInNode(ctx context.Context, node *k3d.Node, cmd []string, stdin io.Read
}
if err != nil {
if execConnection != nil && execConnection.Reader != nil {
- logs, err := io.ReadAll(execConnection.Reader)
- if err != nil {
+ logs, logsErr := io.ReadAll(execConnection.Reader)
+ if logsErr != nil {
return fmt.Errorf("failed to get logs from errored exec process in node '%s': %w", node.Name, err)
}
err = fmt.Errorf("%w: Logs from failed access process:\n%s", err, string(logs))
then the output can be logged successfully:
I'll put up a PR to fix |
rhbuf
added a commit
to rhbuf/k3d
that referenced
this issue
Oct 11, 2022
The assignment from io.ReadAll was overwriting the value of the original error and stopping the logs of the failed exec from being printed fixes k3d-io#1171
iwilltry42
pushed a commit
that referenced
this issue
Dec 30, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What did you do
Import a non-image tar into
k3d
to deliberately causectr
to errorWhat did you expect to happen
I expected to see the error message from the exec appear in the logs from
k3d
, but it is shadowed by theerr
from reading the logsk3d/pkg/runtimes/docker/node.go
Lines 348 to 363 in 516fe7c
Screenshots or terminal output
Which OS & Architecture
Which version of
k3d
Which version of docker
The text was updated successfully, but these errors were encountered: