-
Notifications
You must be signed in to change notification settings - Fork 12
fix: scope support on apply change set #64
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
Merged
Parent:
feat: diode data plugin 1.0 rc
mfiedorowicz
merged 1 commit into
feat-diode-data-plugin
from
fix-apply-change-set-scope-support
Feb 20, 2025
Merged
fix: scope support on apply change set #64
mfiedorowicz
merged 1 commit into
feat-diode-data-plugin
from
fix-apply-change-set-scope-support
Feb 20, 2025
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Signed-off-by: Michal Fiedorowicz <mfiedorowicz@netboxlabs.com>
☂️ Python Coverage
Overall Coverage
New FilesNo new covered files... Modified Files
|
leoparente
approved these changes
Feb 20, 2025
ltucker
approved these changes
Feb 20, 2025
ltucker
pushed a commit
that referenced
this pull request
Mar 27, 2025
Signed-off-by: Michal Fiedorowicz <mfiedorowicz@netboxlabs.com>
ltucker
pushed a commit
that referenced
this pull request
Apr 7, 2025
Signed-off-by: Michal Fiedorowicz <mfiedorowicz@netboxlabs.com>
ltucker
added a commit
that referenced
this pull request
Apr 7, 2025
* fix: scope support on apply change set (#64) Signed-off-by: Michal Fiedorowicz <mfiedorowicz@netboxlabs.com> * wip diff api * set default values and missing slugs Signed-off-by: Michal Fiedorowicz <mfiedorowicz@netboxlabs.com> * tidy up setting defaults Signed-off-by: Michal Fiedorowicz <mfiedorowicz@netboxlabs.com> * remove unused imports Signed-off-by: Michal Fiedorowicz <mfiedorowicz@netboxlabs.com> * fix constructor of object type Signed-off-by: Michal Fiedorowicz <mfiedorowicz@netboxlabs.com> * set slugs (if not present) after resolving existing instances Signed-off-by: Michal Fiedorowicz <mfiedorowicz@netboxlabs.com> * emit ref_id instead of variable object_id field for new objects * improve entity field mapping coverage * fill in primary value mapping, use primary value for slug * use canonical field ordering in change dicts * first pass at certain common circular refs * remove ref id to itself Signed-off-by: Michal Fiedorowicz <mfiedorowicz@netboxlabs.com> * tidy up Signed-off-by: Michal Fiedorowicz <mfiedorowicz@netboxlabs.com> * add applier Signed-off-by: Michal Fiedorowicz <mfiedorowicz@netboxlabs.com> * fix resolve ref before lookup, use field name directly, not field attr * don't query with unresolved references * fix _build_expressions_queryset Signed-off-by: Michal Fiedorowicz <mfiedorowicz@netboxlabs.com> * resolve lint issues Signed-off-by: Michal Fiedorowicz <mfiedorowicz@netboxlabs.com> * exclude fields with GenericRelation type Signed-off-by: Michal Fiedorowicz <mfiedorowicz@netboxlabs.com> * fix sorting dict we may get ints strings etc Signed-off-by: Michal Fiedorowicz <mfiedorowicz@netboxlabs.com> * rework applier logic Signed-off-by: Michal Fiedorowicz <mfiedorowicz@netboxlabs.com> * applier with content type fields Signed-off-by: Michal Fiedorowicz <mfiedorowicz@netboxlabs.com> * fix content type related existing value Signed-off-by: Michal Fiedorowicz <mfiedorowicz@netboxlabs.com> * exclude foreign key fields with many to one rel Signed-off-by: Michal Fiedorowicz <mfiedorowicz@netboxlabs.com> * fix: support for post create updates eg (primary mac address) (#68) * fix: support for post create updates eg (primary mac address) * use serializers, fix relevent tests * linting * filter fields in the prior state * add some basic smoke tests for diff / diff+apply * Change set validation (#69) * add change set validation Signed-off-by: Michal Fiedorowicz <mfiedorowicz@netboxlabs.com> * remove redundant serializers Signed-off-by: Michal Fiedorowicz <mfiedorowicz@netboxlabs.com> * remove redundant serializers tests Signed-off-by: Michal Fiedorowicz <mfiedorowicz@netboxlabs.com> * tidy up Signed-off-by: Michal Fiedorowicz <mfiedorowicz@netboxlabs.com> * adjust tests, lighter validation of refs on diff, handle generic --------- Signed-off-by: Michal Fiedorowicz <mfiedorowicz@netboxlabs.com> Co-authored-by: Michal Fiedorowicz <mfiedorowicz@netboxlabs.com> * fix: expand support for cycle breaking, add additional logical matchers (#70) * fix: fix error fingerprinting tags (#71) * fix: all noops -> no changes, show noops as only prior state (#72) --------- Signed-off-by: Michal Fiedorowicz <mfiedorowicz@netboxlabs.com> Co-authored-by: Michal Fiedorowicz <mfiedorowicz@netboxlabs.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request includes several changes to the
netbox_diode_pluginto improve the handling of object types and scopes, as well as updates to the test suite to cover new functionality. The most important changes include updating methods to handle both string andNetBoxTypeobject types, refining scope handling logic, and adding new test cases.Updates to object type handling:
netbox_diode_plugin/api/views.py: Updated methods_get_index_class_fields,_get_object_type_model, and_get_serializerto handle both string andNetBoxTypeobject types. [1] [2] [3]Refinement of scope handling:
netbox_diode_plugin/api/views.py: Enhanced_get_fields_to_find_existing_objectsto handle nested scope types and updated_handle_scopeto differentiate between nested and top-level objects. [1] [2] [3] [4]Test suite improvements:
netbox_diode_plugin/tests/test_api_apply_change_set.py: Added new test casestest_create_virtualization_cluster_with_site_stored_as_scopeandtest_create_virtualmachine_with_cluster_site_stored_as_scopeto verify correct handling of scopes for clusters and virtual machines.netbox_diode_plugin/tests/test_api_apply_change_set.py: IncludedContentTypeimport and updatedsetUpmethod to initialize clusters with scope types. [1] [2]