-
Notifications
You must be signed in to change notification settings - Fork 221
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
cmd/create: Require valid terminal when prompting to pull an image #1428
cmd/create: Require valid terminal when prompting to pull an image #1428
Conversation
b8babd1
to
213897d
Compare
Build failed. ✔️ unit-test SUCCESS in 7m 08s |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test failure:
not ok 77 create: With a custom image that needs an authentication file in 589ms
fedora-rawhide | # (from function `assert_line' in file test/system/libs/bats-assert/src/assert.bash, line 488,
fedora-rawhide | # in test file test/system/101-create.bats, line 685)
fedora-rawhide | # `assert_line --index 0 "Error: failed to pull image $DOCKER_REG_URI/$image"' failed
fedora-rawhide | #
fedora-rawhide | # -- line differs --
fedora-rawhide | # index : 0
fedora-rawhide | # expected : Error: failed to pull image localhost:50000/fedora-toolbox:34
fedora-rawhide | # actual : Error: User interaction required to pull a new image. Stopping now.
fedora-rawhide | # --
... seems to say that even when toolbox create
was run non-interactively with the --assumeyes
option, it still gave the error about requiring user interaction, instead of saying that it failed to pull the image.
Once --assumeyes
has been given, it shouldn't worry about the standard input stream not being connected to a terminal device.
213897d
to
925e75a
Compare
It doesn't make sense to show the image download prompt when the standard input and output streams are redirected to something other than a terminal device. During such non-interactive use, there's no way for the user to see the prompt and the size of the image and then make a decision based on them. The decision has to be made differently and earlier. The user will either never download or always download or will use 'skopeo inspect' to decide for themself. Secondly, when the input and output are not connected to a terminal, the terminal escape sequences and the terminal-specific ioctl(2) requests used to show the prompt won't work anyway. containers#1428
Build succeeded. ✔️ unit-test SUCCESS in 8m 47s |
I took the liberty to fix this to get the tests to pass, and addressed the above nits. The fact that this tripped up the tests suggests that we should add some new tests for this new error as well. :) |
925e75a
to
8b8a2dc
Compare
It doesn't make sense to show the image download prompt when the standard input or output stream is redirected to something other than a terminal device. During such non-interactive use, there's no way for the user to see the prompt and the size of the image and then make a decision based on them. The decision has to be made differently and earlier. The user will either never download or always download or will use 'skopeo inspect' to decide for themself. Secondly, when the input and output are not connected to a terminal, the terminal escape sequences and the terminal-specific ioctl(2) requests used to show the prompt won't work anyway. Some changes by Debarshi Ray. containers#1428
It doesn't make sense to show the image download prompt when the standard input or output stream is redirected to something other than a terminal device. During such non-interactive use, there's no way for the user to see the prompt and the size of the image and then make a decision based on them. The decision has to be made differently and earlier. The user will either never download or always download or will use 'skopeo inspect' to decide for themself. Secondly, when the input and output are not connected to a terminal, the terminal escape sequences and the terminal-specific ioctl(2) requests used to show the prompt won't work anyway. Some changes by Debarshi Ray. containers#1428
8b8a2dc
to
55c0e63
Compare
Build succeeded. ✔️ unit-test SUCCESS in 7m 13s |
Added some tests and merged. Thanks, @HarryMichal ! |
To limit the possible misbehaviour of Toolbx when ued in scripting, require the presence of valid terminal on stdin when an image needs to be pulled to create a new toolbx.