Look for rootless quadlets in /usr/share/containers/systemd/users#28232
Look for rootless quadlets in /usr/share/containers/systemd/users#28232Luap99 merged 1 commit intocontainers:mainfrom
Conversation
|
Note that I haven't been able to get |
Honny1
left a comment
There was a problem hiding this comment.
Thanks, LGTM. I rerun the failed tests.
| // Add the base directory even if the UID was not found | ||
| paths.Add(filepath.Join(UnitDirAdmin, "users")) | ||
| } | ||
| AppendSubPaths(paths, filepath.Join(UnitDirDistro, "users"), true, nil) |
There was a problem hiding this comment.
for consistency with /etc should this not also support /usr/share/containers/systemd/users/$UID?
There was a problem hiding this comment.
I did consider that when implementing this, and did it at first, but then I decided I don't think it makes sense for the case of /usr. I can't think of a use case where a package would want to have quadlets defined for specific UIDs - in the case of specific UIDs, the /etc route would be better, I'd have thought.
There was a problem hiding this comment.
It is not just packages, in a imaged based/bootc world might want to write there directly and they may very well know the uids in advance.
Also it is about consistency having different behaviours would be more confusing there. In particular a numeric directory name would behave differently as it would not be filtered out
There was a problem hiding this comment.
I have just pushed changes so it works like you suggested, and updated the user-facing change text in my initial comment.
Note that this introduces a (very small) change in behaviour; theoretically someone could have put a quadlet in /usr/share/containers/systemd/users/1234/ which would previously have been detected in rootful mode, but with this change it wouldn't be. This would have been a pretty weird thing to do, but I thought I should flag it anyway. This is due to adding the userLevelFilter to /usr/share/containers/systemd/ for rootful mode, now that we support user directories in there.
| // Add the base directory even if the UID was not found | ||
| paths.Add(filepath.Join(UnitDirAdmin, "users")) | ||
| } | ||
| AppendSubPaths(paths, filepath.Join(UnitDirDistro, "users"), true, nil) |
There was a problem hiding this comment.
Yes, something like this:
| AppendSubPaths(paths, filepath.Join(UnitDirDistro, "users"), true, nil) | |
| basePaths := []string{UnitDirAdmin, UnitDirDistro} | |
| u, err := user.Current() | |
| if err == nil { | |
| for _, basePath := range basePaths { | |
| AppendSubPaths(paths, filepath.Join(basePath, "users"), true, nonNumericFilter) | |
| AppendSubPaths(paths, filepath.Join(basePath, "users", u.Uid), true, userLevelFilter) | |
| } | |
| } else { | |
| logiface.Errorf("Warning: %v", err) | |
| // Add the base directory even if the UID was not found | |
| for _, basePath := range basePaths { | |
| paths.Add(filepath.Join(basePath, "users")) | |
| } | |
| } |
8d2901d to
0c9630d
Compare
|
[NON-BLOCKING] Packit jobs failed. @containers/packit-build please check. Everyone else, feel free to ignore. |
This is a useful place for packagers to put quadlets which they want to make available for all users. Fixes: containers#27843 Signed-off-by: Nick White <git@njw.name>
0c9630d to
1aadae0
Compare
|
@containers/podman-maintainers PTAL |
This is a useful place for packagers to put quadlets which they want to make available for all users.
Fixes: #27843
Checklist
Ensure you have completed the following checklist for your pull request to be reviewed:
commits. (
git commit -s). (If needed, usegit commit -s --amend). The author email must matchthe sign-off email address. See CONTRIBUTING.md
for more information.
Fixes: #00000in commit message (if applicable)make validatepr(format/lint checks)Noneif no user-facing changes)Does this PR introduce a user-facing change?