Skip to content

Commit 7dda581

Browse files
fix: resolve panic when adding list entry before existing one (#1379)
The getDeletedItems (RESTCONF) and addDeletedItemsXML (NETCONF) template functions had swapped loop indices when comparing list-type attributes within list entries. When i iterates state and j is the matched index in data, the code incorrectly read data[i] and state[j], causing an index-out-of-range panic whenever j > len(state)-1 (i.e., a new entry is inserted before an existing one). Fixed at both nesting levels in both functions (4 sites total in gen/templates/model.go). Affects iosxe_route_map, iosxe_crypto_pki, iosxe_radius_server, and iosxe_system generated models. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> AI-Generated: yes AI-Tool: claude-code AI-Model: opus-4.6 AI-Percent: 50 AI-Reason: fix swapped i/j indices in list-diff template
1 parent 0337405 commit 7dda581

8 files changed

Lines changed: 155 additions & 152 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
- Add `iosxe_object_group` resource and data source with FQDN (`object-group fqdn`) and network (`object-group network`) object group support, including name, description, nested group references, host entries, network addresses, address ranges, and regex FQDN patterns
1212
- Add `iosxe_ipv6_prefix_list` resource and data source
1313
- Add `iosxe_parameter_map` resource and data source
14+
- Fix panic in route-map (and other list-entry resources) when adding a new entry before an existing one that contains list-type match/set attributes. The `getDeletedItems` (RESTCONF) and `addDeletedItemsXML` (NETCONF) functions had swapped loop indices when comparing list element values between state and plan.
1415

1516
## 0.17.0
1617

docs/guides/changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ description: |-
2020
- Add `iosxe_object_group` resource and data source with FQDN (`object-group fqdn`) and network (`object-group network`) object group support, including name, description, nested group references, host entries, network addresses, address ranges, and regex FQDN patterns
2121
- Add `iosxe_ipv6_prefix_list` resource and data source
2222
- Add `iosxe_parameter_map` resource and data source
23+
- Fix panic in route-map (and other list-entry resources) when adding a new entry before an existing one that contains list-type match/set attributes. The `getDeletedItems` (RESTCONF) and `addDeletedItemsXML` (NETCONF) functions had swapped loop indices when comparing list element values between state and plan.
2324

2425
## 0.17.0
2526

gen/templates/model.go

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

internal/provider/model_iosxe_crypto_pki.go

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

internal/provider/model_iosxe_radius_server.go

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)