-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Assorted CLI nitpicks #3374
Assorted CLI nitpicks #3374
Conversation
I have |
The value of root is already an absolute path since commit ede8a86, so it does not make sense to call filepath.Abs() again. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
There is a mix of styles when handling CLI commands. In most cases we return an error, which is handled from app.Run in main.go (it calls fatal if there is an error). In a few cases, though, we call fatal(err) from random places. Let's be consistent and always return an error. The only exception is runc exec, which needs to exit with a particular exit code. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
1. Variable xdgRuntimeDir is only checked to be non-empty. Change it to a boolean. 2. Refactor so that os.Getenv is not called twice. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
1. In case --root option is not provided, do nothing. 2. Instead of checking if root value is empty string, check it after filepath.Abs, and reject "/". Improve docstring while at it. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
It is questionable whether runc list should return an empty list of containers when non-existent --root is specified or not. The current behavior is the directory is always created and then the empty list of container is shown. To my mind, specifying a non-existent root is an error and should be reported as such. This is what this patch does. For backward compatibility, if --root is not set (i.e. a default is used), ENOENT is not reported. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
centos 8 CI failure is a flake; working on a fix in #3392 |
I have |
This is mostly some minor refactoring, making things cleaner.
The only significant change is
runc --root non-existent-dir list
now reports an error for non-existent root directory. The error is not reported in case a default root is used.This is a preparation for #3373.