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

Q. How to remove keys on merge? #158

Open
cunningr opened this issue Dec 15, 2023 · 2 comments
Open

Q. How to remove keys on merge? #158

cunningr opened this issue Dec 15, 2023 · 2 comments

Comments

@cunningr
Copy link

cunningr commented Dec 15, 2023

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

@danielcoman
Copy link
Contributor

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

@cunningr
Copy link
Author

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.

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

No branches or pull requests

2 participants