[PR #20246] [MERGED] Closes #20241: Record A & B terminations on cable changelog records #15857

Closed
opened 2025-12-30 00:24:26 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbox-community/netbox/pull/20246
Author: @jeremystretch
Created: 9/4/2025
Status: Merged
Merged: 9/9/2025
Merged by: @jnovinger

Base: mainHead: 20241-cable-change-records


📝 Commits (8)

  • 478755a Adapt testing utilities to disregard "update" changelog records immediately following object creation
  • 48378c5 Closes #20241: Record A & B terminations on cable changelog record
  • f5e69e5 Add deserialize_object() to Cable
  • 38610f7 Fix tests
  • 4349218 Consolidate termination assignment into _get_terminations() and _set_terminations() methods
  • 0402dce Support setting cable terminations from serialized CableTermination IDs
  • 4c66e9a Rename getter & setter utilities for clarity
  • 50b8364 Fix ValueError message formatting

📊 Changes

3 files changed (+122 additions, -55 deletions)

View changed files

📝 netbox/dcim/models/cables.py (+116 -49)
📝 netbox/utilities/testing/api.py (+4 -4)
📝 netbox/utilities/testing/views.py (+2 -2)

📄 Description

Closes: #20241

  • Call save() twice for new cables (before and after updating the terminations)
  • Consolidate the logic for getting/setting A/B terminations into the new _get_x_terminations() and _set_x_terminations() methods
  • Add get_terminations() to Cable to return a mapping of all current CableTerminations
  • Move the logic for updating CableTerminations to a new update_terminations() method on Cable
  • Override serialize_object() on Cable to add a_terminations and b_terminations to the change data
  • Add a complementary deserialize_object() method (for completeness)
  • Update some testing utilities to specifically check for creation records (ignoring subsequent update records)

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/netbox-community/netbox/pull/20246 **Author:** [@jeremystretch](https://github.com/jeremystretch) **Created:** 9/4/2025 **Status:** ✅ Merged **Merged:** 9/9/2025 **Merged by:** [@jnovinger](https://github.com/jnovinger) **Base:** `main` ← **Head:** `20241-cable-change-records` --- ### 📝 Commits (8) - [`478755a`](https://github.com/netbox-community/netbox/commit/478755a8e510dff2c2281c44c388c1ff1f6e5c7f) Adapt testing utilities to disregard "update" changelog records immediately following object creation - [`48378c5`](https://github.com/netbox-community/netbox/commit/48378c502fa8990ed0a7f1486aa75f0d783992a0) Closes #20241: Record A & B terminations on cable changelog record - [`f5e69e5`](https://github.com/netbox-community/netbox/commit/f5e69e5457924fab8b1f81896ad668b5d15f41bb) Add deserialize_object() to Cable - [`38610f7`](https://github.com/netbox-community/netbox/commit/38610f7aafe1de84f4b6222c98b456615ce934f9) Fix tests - [`4349218`](https://github.com/netbox-community/netbox/commit/43492181d4261bc20f5113f0bc97c64e51024bad) Consolidate termination assignment into _get_terminations() and _set_terminations() methods - [`0402dce`](https://github.com/netbox-community/netbox/commit/0402dce4c4486ae72361ed8665e42c04cc2be98f) Support setting cable terminations from serialized CableTermination IDs - [`4c66e9a`](https://github.com/netbox-community/netbox/commit/4c66e9a96c7a7029f401a7c03ca926893c81761d) Rename getter & setter utilities for clarity - [`50b8364`](https://github.com/netbox-community/netbox/commit/50b836473b707f536676d037516e1647862a3339) Fix ValueError message formatting ### 📊 Changes **3 files changed** (+122 additions, -55 deletions) <details> <summary>View changed files</summary> 📝 `netbox/dcim/models/cables.py` (+116 -49) 📝 `netbox/utilities/testing/api.py` (+4 -4) 📝 `netbox/utilities/testing/views.py` (+2 -2) </details> ### 📄 Description ### Closes: #20241 - Call `save()` twice for new cables (before and after updating the terminations) - Consolidate the logic for getting/setting A/B terminations into the new `_get_x_terminations()` and `_set_x_terminations()` methods - Add `get_terminations()` to Cable to return a mapping of all current CableTerminations - Move the logic for updating CableTerminations to a new `update_terminations()` method on Cable - Override `serialize_object()` on Cable to add `a_terminations` and `b_terminations` to the change data - Add a complementary `deserialize_object()` method (for completeness) - Update some testing utilities to specifically check for creation records (ignoring subsequent update records) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2025-12-30 00:24:26 +01:00
adam closed this issue 2025-12-30 00:24:26 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#15857