Skip to content

Split sync ironic and implement sync netbox with URL filtering#1827

Merged
berendt merged 1 commit intomainfrom
sync-netbox-2
Nov 22, 2025
Merged

Split sync ironic and implement sync netbox with URL filtering#1827
berendt merged 1 commit intomainfrom
sync-netbox-2

Conversation

@berendt
Copy link
Copy Markdown
Member

@berendt berendt commented Nov 22, 2025

Split the bidirectional sync ironic command into two separate commands:

  • sync ironic: NetBox → Ironic synchronization (unchanged direction)
  • sync netbox: Ironic → NetBox synchronization (new command)

The sync ironic command now only synchronizes from NetBox to Ironic, creating/updating/deleting Ironic nodes based on NetBox devices. The previously embedded Ironic → NetBox state updates have been removed and moved to the new sync netbox command.

Implement sync netbox command to synchronize Ironic node states to NetBox:

  • Updates provision_state, power_state, and maintenance custom fields
  • Syncs to primary NetBox and all configured secondary instances
  • Supports optional node_name parameter to sync specific nodes
  • Add --netbox-filter parameter for selective NetBox instance updates
  • Filter uses case-insensitive substring matching on base_url

The URL filter enables targeted synchronization scenarios:

  • Sync only to primary NetBox: --netbox-filter primary
  • Sync only to specific secondary: --netbox-filter secondary-1
  • Sync to environment-specific instances: --netbox-filter prod

This separation allows independent execution of each sync direction and provides fine-grained control over which NetBox instances to update.

AI-assisted: Claude Code

Split the bidirectional sync ironic command into two separate commands:
- sync ironic: NetBox → Ironic synchronization (unchanged direction)
- sync netbox: Ironic → NetBox synchronization (new command)

The sync ironic command now only synchronizes from NetBox to Ironic,
creating/updating/deleting Ironic nodes based on NetBox devices. The
previously embedded Ironic → NetBox state updates have been removed
and moved to the new sync netbox command.

Implement sync netbox command to synchronize Ironic node states to NetBox:
- Updates provision_state, power_state, and maintenance custom fields
- Syncs to primary NetBox and all configured secondary instances
- Supports optional node_name parameter to sync specific nodes
- Add --netbox-filter parameter for selective NetBox instance updates
- Filter uses case-insensitive substring matching on base_url

The URL filter enables targeted synchronization scenarios:
- Sync only to primary NetBox: --netbox-filter primary
- Sync only to specific secondary: --netbox-filter secondary-1
- Sync to environment-specific instances: --netbox-filter prod

This separation allows independent execution of each sync direction
and provides fine-grained control over which NetBox instances to update.

AI-assisted: Claude Code

Signed-off-by: Christian Berendt <berendt@osism.tech>
@berendt berendt merged commit 850b26c into main Nov 22, 2025
2 checks passed
@berendt berendt deleted the sync-netbox-2 branch November 22, 2025 13:28
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.

1 participant