-
Notifications
You must be signed in to change notification settings - Fork 2.8k
add --module flag #19567
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
add --module flag #19567
Conversation
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: vrothberg The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
64d51d2
to
46ed95e
Compare
@Luap99 @rhatdan @edsantiago WDYT? |
@Luap99 any idea why I am observing the following in shell completion?
Above it's perfectly capable of detecting the files in the XDG_CONFIG_HOME but it's unable to complete and will pick a path in CWD instead. EDIT need to fix your comment before and will retry. |
Another problem I just realized, I think we must pass Now doing this sounds easy but there is one big problem with that, if a user starts a container with a module then removes the module file, the cleanup command will fail immediately without doing anything which will be very problematic. Now this is of course a corner case but one that could be impossible to debug as there are almost never logs from the cleanup command. I think there are other cases were this is already a problem, i.e. adding a options that fail config validation so this is not exactly a new problem but one to keep in mind. |
A weird thing happened when I tried testing completion: $ mkdir -p /tmp/fakehome/.config/containers/containers.conf.modules
$ touch /tmp/fakehome/.config/containers/containers.conf.modules/sdfsdf.conf
$ XDG_CONFIG_HOME=/tmp/fakehome/.config bin/podman __completeNoDesc --module ''
sdfsdf.conf <------- this is good
:4
Completion ended with directive: ShellCompDirectiveNoFileComp
$ XDG_CONFIG_HOME=/tmp/fakehome/.config bin/podman __completeNoDesc --module 'x'
Failed to obtain podman configuration: could not resolve module "x": 3 errors occurred:
* stat /tmp/fakehome/.config/containers/containers.conf.modules/x: no such file or directory
* stat /etc/containers/containers.conf.modules/x: no such file or directory
* stat /usr/share/containers/containers.conf.modules/x: no such file or directory |
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 is way more than I can possibly review, so I just focused on some super-minor nits in tests. Will make another review pass later.
Nice catch, Ed. Thank you! I think that explains my observation as well. Explanation: modules should not be loaded during shell completion. |
Pushed a new version with the comments addressed. Still not ready to go but I'll be buried in meetings for a while. |
I honestly never thought of it before but see how this can cause hard to debug issues. Mind opening an issue for it? |
@rhatdan @Luap99 @edsantiago PTanotherL Once I have your blessings, we can merge containers/common#1599 and properly vendor c/common in here. |
This is still open and important, especially when a container uses --restart=always. |
Also I see no mentions in the docs that --module is not supported on the remote client. |
Thanks! I will add that. Can you elaborate on the |
For example |
Done ✔️ Also added a regression test: https://github.com/containers/podman/pull/19567/files#diff-07cf7ec60df1f145e45014e0a31d374cde4b1fb4f28cf3999c4e13293b6dc541R127-R131 |
Fresh thought: do we need to worry/care about people who try Was any consideration given to using What is the reason for |
Would you consider adding a few more tests? You also might want to fix some stutter. One of them should be easy, the other, not so much. |
HOME is always ignored by Podman when running as root. I think modules should remain consistent with that.
Yes. Mixing with
You are right on spot. Imagine an
I hope so. I mean at that point we had weeks of conversations with the requester, a reviewed design document and the other PR in containers/common. If you don't feel comfortable with the current implementation, please block before merging the PR.
Will do, thanks a lot! |
Now vendoring c/common@main. @rhatdan @Luap99 PTanotherL |
Sorry, I didn't express myself right. I was thinking of someone creating Please don't gate on me. I'm really uncomfortable with this concept, but tests LGTM (thanks for adding those) and I can't find any specific showstoppers. |
I am curious what others think. So far, rootful Podman ignores all rootless configs. Same for other tools ignoring settings in XDG_CONFIG_HOME. |
I don't understand the Windows error (https://github.com/containers/podman/pull/19567/checks?check_run_id=15935251777). @Luap99 @edsantiago do you know what's going on? |
c/common changed the machine defaults, I think you need to merge + rebase onto #19596 |
I don't understand the issue here, sudo is running as root so of course it should ignore rootless configurations. I don't see surprise factor? Like would you expect |
Support a new concept in containers.conf called "modules". A "module" is a containers.conf file located at a specific directory. More than one module can be loaded in the specified order, following existing override semantics. There are three directories to load modules from: - $CONFIG_HOME/containers/containers.conf.modules - /etc/containers/containers.conf.modules - /usr/share/containers/containers.conf.modules With CONFIG_HOME pointing to $HOME/.config or, if set, $XDG_CONFIG_HOME. Absolute paths will be loaded as is, relative paths will be resolved relative to the three directories above allowing for admin configs (/etc/) to override system configs (/usr/share/) and user configs ($CONFIG_HOME) to override admin configs. Pulls in containers/common/pull/1599. Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
It's not about what I expect, it's about end users. We seem to get frequent "sudo doesn't work" questions, and this is just one more thing for less-experienced users to trip on. Anyhow, enough. We can live with that. |
OK, we're green. |
LGTM |
/lgtm |
Support a new concept in containers.conf called "modules". A "module"
is a containers.conf file located at a specific directory. More than
one module can be loaded in the specified order, following existing
override semantics.
There are three directories to load modules from:
With CONFIG_HOME pointing to $HOME/.config or, if set, $XDG_CONFIG_HOME.
Absolute paths will be loaded as is, relative paths will be resolved
relative to the three directories above allowing for admin configs
(/etc/) to override system configs (/usr/share/) and user configs
($CONFIG_HOME) to override admin configs.
Pulls in containers/common/pull/1599.
Does this PR introduce a user-facing change?