Skip to content
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

fix: logs error shadowing exec error #1172

Merged
merged 1 commit into from
Dec 30, 2022
Merged

fix: logs error shadowing exec error #1172

merged 1 commit into from
Dec 30, 2022

Conversation

rhbuf
Copy link
Contributor

@rhbuf rhbuf commented Oct 11, 2022

What

Rename an inner error to logsError to stop it shadowing the value of a higher scoped err.

Why

The assignment from io.ReadAll was overwriting the value of the original error and stopping the logs of the failed exec from being printed.

Implications

fixes #1171

Now when k3d image import fails the logs from the failed command will be logged (this is intended behaviour):

$ ../k3d/bin/k3d image import -c local -m direct test.tar
INFO[0000] Importing image(s) into cluster 'local'      
INFO[0000] Importing images from 1 tarball(s)...        
INFO[0000] Importing images '[test.tar]' into node 'k3d-local-server-0'... 
ERRO[0001] Failed to import image(s) into cluster 'local': could not load image to cluster from stream test.tar: error loading image to cluster, first error: failed to import images in node 'k3d-local-server-0': Exec process in node 'k3d-local-server-0' failed with exit code '1': Logs from failed access process:
ctr: unrecognized image format 
WARN[0001] At least one error occured while trying to import the image(s) into the selected cluster(s)

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
Copy link
Member

Makes total sense, thank you!

@iwilltry42 iwilltry42 merged commit e4f1f63 into k3d-io:main Dec 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Image import exec failure logs are hidden
2 participants