coreos / butane

Butane translates human-readable Butane Configs into machine-readable Ignition Configs.
https://coreos.github.io/butane/
Apache License 2.0
255 stars 70 forks source link

Error when trying to use 'files:', 'append:' in butane file #531

Closed TeamLinux01 closed 5 months ago

TeamLinux01 commented 6 months ago

I am trying to use the following snippit in my butane file.

variant: fcos
version: 1.5.0
...
storage:
...
  files:
    - path: /etc/sysctl.conf
      append:
        inline: "net.ipv4.ip_unprivileged_port_start=80"
...

When running the commnd

podman run -ti --rm --security-opt label=disable -v ./:/pwd --workdir /pwd quay.io/coreos/butane:release --pretty  --strict ucore-autorebase.butane > ucore.ign

it has the following error

Error translating config: yaml: unmarshal errors:
  line 73: cannot unmarshal !!map into []v0_5.Resource

It transpiles correctly if I change append to contents.

travier commented 6 months ago

You should use independent config snippets like /etc/sysctl.d/foo.conf instead of changing /etc/sysctl.conf.

travier commented 6 months ago

See: https://docs.fedoraproject.org/en-US/fedora-coreos/sysctl/

TeamLinux01 commented 6 months ago

Thanks, I did end up using contents: with the /etc/sysctl.d/ directory instead. I wonder why I get an error when trying to use append:.

Maybe I don't really understand how to use append:. Either way, I was able to get what I needed accomplished.