-
Notifications
You must be signed in to change notification settings - Fork 29
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
Changed always true for some reason #25
Comments
According to RFC the following removes initial config if it is present, thus considreing operation changed ...
- op: add
path: "/log-opts"
value: {}
... In that regard the RFC is not really fit for configuration management where we need to ensure presence of deep values without unnecessary resets (what if So we can just ignore the RFC and make
|
I don't like ignoring RFCs, but I just hit this same problem, and you're right that it is very unhelpful for config files. Instead of changing the behavior in an unexpected way (for those who want the RFC followed by default, which is probably the correct thing to do), I propose one or more of the following:
Since I think option 1 is the most useful and clear, I'm going to get a PR going for it. Should be in by tomorrow and we can continue discussing there :) |
Fixes: particledecay#25 Adds an option to the module which will create any parent objects/arrays needed to reach the child member in an "add" operation. If the next reference token in the path is either "0" or "-", an array will be created. If it is any other number, the parent will not be created and the operation will fail to avoid edge cases and quirks in idempotency. In all other cases, an object is created. This is in direct contradiction to Section 4.1 of RFC6902, which is why this feature is OFF by default. However, it makes this module much more useful when editing JSON configs.
PR submitted. To ease documentation and avoid confusion, I went with option 2 instead. Hopefully @particledecay will have some time to take a look :) |
I'm trying to write task to change docker config, and restart docker service only if it was changed - and json_patch task for some reason always return
changed: True
Return:
Task example:
The text was updated successfully, but these errors were encountered: