Skip to content
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

bib failed to build out config.toml with customizations.filesystem.mountpoint #655

Closed
chunfuwen opened this issue Sep 24, 2024 · 3 comments · Fixed by #656
Closed

bib failed to build out config.toml with customizations.filesystem.mountpoint #655

chunfuwen opened this issue Sep 24, 2024 · 3 comments · Fixed by #656

Comments

@chunfuwen
Copy link

chunfuwen commented Sep 24, 2024

step 1 create one config.toml with customization.filesystem as below:



[root@xx tmt]# cat /var/lib/libvirt/images/config.toml
[[customizations.filesystem]]
mountpoint = "/"
minsize = "10 GiB"

[[customizations.filesystem]]
mountpoint = "/var/data"
minsize = "20 GiB"

step 2 , run bib to generate image, but throw error as below:

(92lts-p3-ve) [xx]# sudo podman run --rm -it --privileged --pull=newer --security-opt label=type:unconfined_t -v /var/lib/libvirt/images/output:/output -v /var/lib/libvirt/images/config.toml:/config.toml   -v /var/lib/libvirt/images/auth.json:/run/containers/0/auth.json  quay.io/centos-bootc/bootc-image-builder:latest  --type vhd --tls-verify=false  --config /config.toml  quay.io/fedora/fedora-bootc:latest  --rootfs xfs
Generating manifest manifest-vhd.json
2024/09/24 09:08:34 error: cannot build manifest: cannot read config: cannot decode "/config.toml": unknown keys found: [customizations.filesystem.mountpoint customizations.filesystem.minsize customizations.filesystem.mountpoint customizations.filesystem.minsize]

@chunfuwen
Copy link
Author

By the way, if use config.json format, it does work.

@mvo5
Copy link
Collaborator

mvo5 commented Sep 24, 2024

I can reproduce and know what the issue is, it's a regression from #549 - it's not yet clear what the best fix but I'm on it

mvo5 added a commit to mvo5/images that referenced this issue Sep 24, 2024
The current toml filesytem customizations will decode a
`FilesystemCustomization` as a map[string]interface{}. This means
that the underlying toml engine will not konw what keys inside the
map are decoded and which are not decoded. This lead to the issue
osbuild/bootc-image-builder#655 in
`bootc-image-builder` where we check if we have unencoded entries
and if so error (in this case incorrectly).

This commit fixes the issue by moving the toml decoding from the
struct/map[string]interface{} to primitive types. It's a bit
ugly as is (partly because of the limited go type system) but
with that the tests pass and len(meta.Undecoded()) is the expected
zero.

I opened BurntSushi/toml#425 to see if
there is another way via a custom unmarshaler.
@mvo5
Copy link
Collaborator

mvo5 commented Sep 24, 2024

The underlying issue is osbuild/images#951 - this needs some tweaking/thinking, we should probably do a quicker fix (by disabling the meta.Undecoded() check) short term as this is a rather big regression :/

Thanks for catching/reporting this!

mvo5 added a commit to mvo5/bootc-image-builder that referenced this issue Sep 24, 2024
This commit partially reverts PT#549 to unblock filesystem
customizations in bib.

This is a short term fix and we should revert and do something
smarter like osbuild/images#951 or see
if we can do better in the toml unmarshaling. But to unblock
toml customizations this is a (IMHO) reasonable first step.

Closes: osbuild#655
mvo5 added a commit to mvo5/images that referenced this issue Sep 24, 2024
The current toml filesytem customizations will decode a
`FilesystemCustomization` as a map[string]interface{}. This means
that the underlying toml engine will not konw what keys inside the
map are decoded and which are not decoded. This lead to the issue
osbuild/bootc-image-builder#655 in
`bootc-image-builder` where we check if we have unencoded entries
and if so error (in this case incorrectly).

This commit fixes the issue by moving the toml decoding from the
struct/map[string]interface{} to primitive types. It's a bit
ugly as is (partly because of the limited go type system) but
with that the tests pass and len(meta.Undecoded()) is the expected
zero.

I opened BurntSushi/toml#425 to see if
there is another way via a custom unmarshaler.
mvo5 added a commit to mvo5/bootc-image-builder that referenced this issue Sep 25, 2024
This commit partially reverts PT#549 to unblock filesystem
customizations in bib.

This is a short term fix and we should revert and do something
smarter like osbuild/images#951 or see
if we can do better in the toml unmarshaling. But to unblock
toml customizations this is a (IMHO) reasonable first step.

Closes: osbuild#655
github-merge-queue bot pushed a commit that referenced this issue Sep 25, 2024
This commit partially reverts PT#549 to unblock filesystem
customizations in bib.

This is a short term fix and we should revert and do something
smarter like osbuild/images#951 or see
if we can do better in the toml unmarshaling. But to unblock
toml customizations this is a (IMHO) reasonable first step.

Closes: #655
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants