Repository navigation
Implement rootless container introspection - #2617
Conversation
This lets us read os-release files from other forms of sources.
This will let us later use a custom fs implementation to read from other types of sources.
|
|
||
| // Ensure os.IsNotExist() works on the errors | ||
| func (fsys podmanUnshareFS) wrapErr(op, name string, err error) error { | ||
| if !fsys.exists(name) { |
There was a problem hiding this comment.
I don't have a better idea but this triggers a second subprocess for each error case.
There was a problem hiding this comment.
The alternative is an "exists" subprocess for each operation, doesn't seem better...
supakeen
left a comment
There was a problem hiding this comment.
The previous PR was supposed to be an approval since I had only nitpicky small things but apparently I had hit the wrong checkbox.
1a728f7 to
3c093e1
Compare
supakeen
left a comment
There was a problem hiding this comment.
Thank you for fixing my nits however unlikely they are to be triggered.
3c093e1 to
65d64f3
Compare
To make "podman mount" work in the rootless case we run it inside a "podman unshare" wrapper. However, this means the mount is not visible in the current namespace, all access to the mount must be done in another process that is also inside a "podman unshare". For this to work we switch Container.Root() to Container.RootFS(), which in the rootless case is a new fs.FS implementation that accesses the mount using standard tools (test/cat/stat/find) from the host inside a "podman unshare".
If we're not uid 0, use the per-user container store instead of the system global one.
65d64f3 to
43288e2
Compare
avitova
left a comment
There was a problem hiding this comment.
Just a preference/readability thing, but I don't want to block this, let's get this in.
| func getXdgDataDir() string { | ||
| dataHome := os.Getenv("XDG_DATA_HOME") | ||
| if dataHome == "" { | ||
| home := os.Getenv("HOME") | ||
| if home != "" { | ||
| dataHome = filepath.Join(home, ".local", "share") | ||
| } | ||
| } | ||
| return dataHome | ||
| } |
There was a problem hiding this comment.
func getXdgDataDir() string {
if dataHome := os.Getenv("XDG_DATA_HOME"); dataHome != "" {
return dataHome
}
if home := os.Getenv("HOME"); home != "" {
return filepath.Join(home, ".local", "share")
}
return ""
}Feels a bit more readable to me, but I like early reaturns overall, and it's probably a question of preference.
There was a problem hiding this comment.
I agree, but lets not block this.
achilleas-k
left a comment
There was a problem hiding this comment.
Great work. Thank you.
LGTM
This makes container introspection (osinfo) work when run as non-root, by using unprivileged podman and looking in the per-user podman container storage.
Fixes #2568
This means something like
image-builder manifest --bootc-default-fs ext4 --bootc-ref quay.io/fedora/fedora-bootc:44 qcow2now works as a user.NOTE;
image-builder build, doesn't yet work as it needs some additional work to have osbuild look into the right container store.