Q. How to remove keys on merge?
cunningr opened this issue · comments
Expected Behaviour
If I am setting a key/object in my top level globals.yaml
at a specific lower level, I want to be able to remove that key (e.g. not just set the value: null
but actually del
). For example:
global.yaml
modules_to_deploy:
module1: <config-mod1>
module2: <config-mod2>
module3: <config-mod3>
then in my special_dr_site.yaml
:
modules_to_deploy:
module2: #remove
After merging, for my special_dr_site
, I want the resulting yaml to be:
modules_to_deploy:
module1: <config-mod1>
module3: <config-mod3>
Actual Behaviour
Not sure if/how this can be achieved?
Reproduce Scenario (including but not limited to)
simply try the simple example above.
Steps to Reproduce
see above example
Platform and Version
Any
You can manipulate the resulting yaml file with these two cmd arguments:
--filter FILTER keep these keys from the generated data
--exclude EXCLUDE exclude these keys from generated data
Thanks @danielcoman. This doesn't quite fit our use case. We are using himl as part of an Ansible dynamic inventory script. We could change the processing settings but what we are looking for the ability to to set some flag in the YAML being processed to indicate that key should be deleted.