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: support for post create updates eg (primary mac address) #68

Merged
merged 5 commits into from
Apr 2, 2025

Conversation

ltucker
Copy link

@ltucker ltucker commented Apr 1, 2025

This handles post-create updates like primary mac address on interface.
It also defers merging the updated state with the prior state until display time (makes things slightly simpler for this purpose as well). There is a related change in the assurance plugin.

@CLAassistant
Copy link

CLAassistant commented Apr 1, 2025

CLA assistant check
All committers have signed the CLA.

@github-actions github-actions bot added the python label Apr 1, 2025
Copy link
Member

@mfiedorowicz mfiedorowicz left a comment

Choose a reason for hiding this comment

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

🙌

Copy link

github-actions bot commented Apr 2, 2025

☂️ Python Coverage

current status: ✅

Overall Coverage

Lines Covered Coverage Threshold Status
1952 1763 90% 0% 🟢

New Files

File Coverage Status
netbox_diode_plugin/tests/test_api_diff_and_apply.py 100% 🟢
netbox_diode_plugin/tests/test_api_generate_diff.py 100% 🟢
TOTAL 100% 🟢

Modified Files

File Coverage Status
netbox_diode_plugin/api/applier.py 84% 🟢
netbox_diode_plugin/api/common.py 73% 🟢
netbox_diode_plugin/api/differ.py 90% 🟢
netbox_diode_plugin/api/matcher.py 80% 🟢
netbox_diode_plugin/api/plugin_utils.py 98% 🟢
netbox_diode_plugin/api/transformer.py 82% 🟢
netbox_diode_plugin/api/views.py 77% 🟢
netbox_diode_plugin/tests/test_api_apply_change_set.py 99% 🟢
TOTAL 85% 🟢

updated for commit: 785a98b by action🐍

@ltucker ltucker force-pushed the handle_mac_address branch from 31c4896 to 785a98b Compare April 2, 2025 13:53
@ltucker ltucker merged commit efab6bb into update_data_model Apr 2, 2025
3 checks passed
@ltucker ltucker deleted the handle_mac_address branch April 2, 2025 14:00
ltucker added a commit that referenced this pull request Apr 7, 2025
* 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
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 <[email protected]>

* wip diff api

* set default values and missing slugs

Signed-off-by: Michal Fiedorowicz <[email protected]>

* tidy up setting defaults

Signed-off-by: Michal Fiedorowicz <[email protected]>

* remove unused imports

Signed-off-by: Michal Fiedorowicz <[email protected]>

* fix constructor of object type

Signed-off-by: Michal Fiedorowicz <[email protected]>

* set slugs (if not present) after resolving existing instances

Signed-off-by: Michal Fiedorowicz <[email protected]>

* 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 <[email protected]>

* tidy up

Signed-off-by: Michal Fiedorowicz <[email protected]>

* add applier

Signed-off-by: Michal Fiedorowicz <[email protected]>

* 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 <[email protected]>

* resolve lint issues

Signed-off-by: Michal Fiedorowicz <[email protected]>

* exclude fields with GenericRelation type

Signed-off-by: Michal Fiedorowicz <[email protected]>

* fix sorting dict

we may get ints strings etc

Signed-off-by: Michal Fiedorowicz <[email protected]>

* rework applier logic

Signed-off-by: Michal Fiedorowicz <[email protected]>

* applier with content type fields

Signed-off-by: Michal Fiedorowicz <[email protected]>

* fix content type related existing value

Signed-off-by: Michal Fiedorowicz <[email protected]>

* exclude foreign key fields with many to one rel

Signed-off-by: Michal Fiedorowicz <[email protected]>

* 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 <[email protected]>

* remove redundant serializers

Signed-off-by: Michal Fiedorowicz <[email protected]>

* remove redundant serializers tests

Signed-off-by: Michal Fiedorowicz <[email protected]>

* tidy up

Signed-off-by: Michal Fiedorowicz <[email protected]>

* adjust tests, lighter validation of refs on diff, handle generic

---------

Signed-off-by: Michal Fiedorowicz <[email protected]>
Co-authored-by: Michal Fiedorowicz <[email protected]>

* 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 <[email protected]>
Co-authored-by: Michal Fiedorowicz <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants