ManageIQ / manageiq

ManageIQ Open-Source Management Platform
https://manageiq.org
Apache License 2.0
1.35k stars 900 forks source link

Settings files with string keys clobbers settings instead of merging #23168

Open Fryguy opened 2 months ago

Fryguy commented 2 months ago

If a config/settings.local.yml file is present, and the internal keys are strings, then it clobbers settings from other sections.

  1. Create a config/settings.local.yml file such as
    prototype:
     test: test
  2. Open a rails console
  3. See that other settings are gone Before:

    > Settings.prototype.to_hash
    => {:amazon=>{:s3=>false}, :ems_vmware=>{:allow_direct_hosts=>false}, :ems_workflows=>{:enabled=>true}}

    After

    > Settings.prototype.to_hash
    => {:test=>"test"}

Note that if you use symbol keys the merging works fine

:prototype:
  :test: test
> Settings.prototype.to_hash
=> {:amazon=>{:s3=>false}, :ems_vmware=>{:allow_direct_hosts=>false}, :ems_workflows=>{:enabled=>true}, :test=>"test"}

I've created #23167 to at least give a clue that changes are present, since the settings.local.yml file is gitignored.

Fryguy commented 2 months ago

Note that if you modify non-local files (e.g. config/settings.yml) with string keys this also happens. I've changed the Issue title to reflect that it's really any settings files.