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

Fix #805: Netbox ansible custom_fields are not idempotent #839

Conversation

cfiehe
Copy link
Contributor

@cfiehe cfiehe commented Oct 10, 2022

This fix ensures the idempotency of the Netbox modules when custom_fields are used.

Signed-off-by: Christoph Fiehe [email protected]

Related Issue

#805: Netbox ansible custom_fields are not idempotent

New Behavior

The fix removes all null values from the current custom fields and ensures that only values, which are actually set, are compared with the target state.

Contrast to Current Behavior

This new behavior ensures the idempotency of the Netbox modules when custom_fields are used.

Discussion: Benefits and Drawbacks

  • Idempotency is an important topic in every configuration management tool, because it ensures that an already reached target state does not need any further configuration changes.
  • From my point of view this fix is fully backward compatible and should have no unforeseen side-effects.
  • One situation cannot be handled right now: When optional custom fields are used, which have a default value. There is no easy way to detect this, when the value is not contained in the target state provided via Ansible.

Changes to the Documentation

None.

Proposed Release Note Entry

None.

Double Check

  • I have read the comments and followed the CONTRIBUTING.md.
  • I have explained my PR according to the information in the comments or in a linked issue.
  • My PR targets the devel branch.

@rodvand
Copy link
Contributor

rodvand commented Oct 10, 2022

Thanks for the PR! Could you format your code using black? You can just run ./hacking/black.sh from the root folder.

@cfiehe cfiehe force-pushed the 805-fix-netbox-custom_fields-are-not-idempotent branch from 92da4bb to 0e51ac6 Compare October 10, 2022 17:30
@cfiehe
Copy link
Contributor Author

cfiehe commented Oct 10, 2022

Thanks for the PR! Could you format your code using black? You can just run ./hacking/black.sh from the root folder.

Yes, of course. I am sorry!

Copy link
Contributor

@sc68cal sc68cal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic looks correct, just need to make black happy

@rodvand rodvand merged commit f470d34 into netbox-community:devel Oct 10, 2022
@cfiehe
Copy link
Contributor Author

cfiehe commented Oct 11, 2022

Thank you very much 🙂.

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

Successfully merging this pull request may close these issues.

3 participants