rancher / elemental-toolkit

:snowflake: The toolkit to build, ship and maintain cloud-init driven Linux derivatives based on container images
https://rancher.github.io/elemental-toolkit/docs/
Apache License 2.0
288 stars 49 forks source link

Prevent overwriting of existing feature config files on elemental init #2063

Open anmazzotti opened 3 months ago

anmazzotti commented 3 months ago

Is your feature request related to a problem? Please describe.

When invoking elemental init, any existing feature config file on the system will be overwritten. For example:

COPY my/custom/04_accounting.yaml /system/oem/04_accounting.yaml
RUN elemental init --force cloud-config-defaults

The 04_accounting.yaml coming with the cloud-config-defaults feature will overwrite the custom one I copied before. There is no clear indication of the overwriting, so this is prone to mistakes when customizing a derivative image.

Describe the solution you'd like

I would like a warning to highlight which files are going to be overwritten. Ideally I would like elemental init and my image build to fail due to file conflicts, rather than just emitting a warning.

Describe alternatives you've considered

Simply copying the custom file after running elemental init solves the problem.
The only trouble I have with this is that it's a bit counter-intuitive, as a user I'd expect to fully customize my derivative image before invoking elemental init, so that init will be the last step.