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
[Bug]: Netbox ansible custom_fields are not idempotent #805
Comments
I can also +1 this bug, there are custom fields that I set in |
I think there's another issue for this as well. Not sure how to tackle it - any suggestions on logic to handle this? |
I think this behavior is correct, since |
Unfortunately, that is not correct. Fields like |
Sorry, I didn't express myself correctly. What I ment to say is (maybe I'm wrong?) that the content of data:
prefix: "1.2.3.0/24"
status: "Active"
description: "Something" And the data:
prefix: "1.2.3.0/24"
status: "Active"
description: "Something"
custom_fields:
cf3: "something"
cf4: "something_else" I wanted to say that there already seems to be a mechanism to enumerate through a dict and correctly check for diffs. Maybe that mechanism can be applied to enumerate through the values of the |
I have created a pull request that should fix the issue described here. The main problem is, that fields, which are unset, are compared with the target state, which does not contain those fields. You can see the issue here:
We have only one change here With the fix we get only this:
And all following runs give you:
|
Ansible NetBox Collection version
3.7.1
Ansible version
NetBox version
Python version
3.8
Steps to Reproduce
Note:
cf1
andcf2
custom_fields are defined in netbox but not used in this runExpected Behavior
When running a playbook with
custom_fields
, I would expect the modules to be idempotent.In this example I am defining two
custom_fields
in aprefix
that has fourcustom_fields
defined in netbox.If nothing changed, I would expect the diff to be unchanged.
Observed Behavior
However, instead of returning an "OK" Status, the run suggests there have been changes.
This is suboptimal, since I want to run a pipeline that checks for changes in netbox. It is hard to focus on what really changed, since the custom_fields suggest a change where none happened.
The text was updated successfully, but these errors were encountered: