Skip to content

Fix: Show neutral indicator for inherited sync status#114

Open
berlikm wants to merge 6 commits into
OpensourceICTSolutions:developmentfrom
berlikm:fix/inherited-sync-status
Open

Fix: Show neutral indicator for inherited sync status#114
berlikm wants to merge 6 commits into
OpensourceICTSolutions:developmentfrom
berlikm:fix/inherited-sync-status

Conversation

@berlikm

@berlikm berlikm commented Jul 13, 2026

Copy link
Copy Markdown

Summary

Shows a neutral grey indicator for inherited assignments in the Zabbix tab, instead of the misleading red X 'Never synced'. Inherited assignments are read-only copies — their sync status is not persisted by design.

Changes

  • InheritedSyncStatusColumn — checks _inherited_from attribute. If set, renders a neutral 'sync' icon. Otherwise falls back to the normal success/failure indicators.
  • Applied to both ZabbixServerAssignmentTable (list view) and ZabbixServerAssignmentObjectViewTable (device/VM tab).

Dependencies

Stacks on PR #115. Merge after #115.

Testing

All existing tests pass. Verified on dev NetBox — inherited assignments show grey indicator, direct assignments show green/red.

Part of #121.

berlikm added 3 commits July 14, 2026 14:15
Adds Site, SiteGroup, and Region as valid assignment targets for all
ZabbixServerAssignment, ZabbixHostgroupAssignment, ZabbixTemplateAssignment,
ZabbixTagAssignment, ZabbixMacroAssignment, and ZabbixHostInventory objects.

This allows assignments made at the Site/SiteGroup/Region level to be
inherited by all devices and VMs at that site or below, via the existing
inheritance_chain mechanism.

Changes:
- Constants: Site/SiteGroup/Region added to ASSIGNMENT_MODELS, ASSIGNMENT_TYPE_TO_FIELD, PATH_LABELS
- Forms: All 7 assignment forms get Site/SiteGroup/Region DynamicModelChoiceField + FieldSet
- Settings: inheritance_chain extended with Site/SiteGroup/Region resolution paths
- Jobs: SyncHostJob._prepare_assignment() creates detached copies for inherited assignments
- HostSync: _get_sync_target() resolves actual Device/VM for Jinja2 rendering
- HostSync: get_tag_attributes() deduplicates tags by (tag, value) to prevent
  Zabbix 7 rejecting duplicate pairs inherited from multiple sources
- HostInterfaceSync: get_create_params() falls back to the device's primary IP
  when the interface has no IP assigned (e.g. when inherited from SiteGroup)
- HostInterfaceSync: errors are caught per-interface so one failing interface
  does not prevent the remaining interfaces and templates from being synced
- Inheritance: ConfigGroup interface expansion removed; interfaces are now
  resolved naturally via the inheritance chain with primary IP fallback
- SyncBase: _is_inherited_copy guard prevents save()/update_sync_info() on inherited copies
- Views: ZabbixSiteTabView, ZabbixSiteGroupTabView, ZabbixRegionTabView added
- Tests: 9 new tests for inheritance resolution

Tested: all 1076 existing tests pass. Verified end-to-end on dev NetBox.
- Filter inherited/direct ZabbixServerAssignment and ZabbixHostInterface by zabbixserver
- Resolve ConfigGroup interface IP from primary_ip4/primary_ip6
- Add seen-set cycle guard to resolve_path
- Fixes silent dropping of Site/SiteGroup assignments
@berlikm
berlikm force-pushed the fix/inherited-sync-status branch from 1fe972b to 48326cb Compare July 14, 2026 14:34
berlikm added 3 commits July 14, 2026 14:54
Fixes inherited Site/SiteGroup/Region assignments reading custom fields from
the intermediate object instead of the actual Device/VM.
Inherited ZabbixServerAssignment rows (from Site, SiteGroup, Platform, etc.)
always show a red X ('Never synced') because update_sync_info() is correctly
skipped for inherited copies. This is misleading — the host may have been
successfully synced.

Adds InheritedSyncStatusColumn which checks the _inherited_from attribute
(set during inheritance resolution) and shows a neutral grey sync icon
with tooltip 'Inherited assignment (Site). Sync this host using the
Zabbix sync action.' instead of the red X.

This follows the same pattern as InheritanceAwareActionsColumn which
already hides edit/delete buttons for inherited rows.

The accessor is set to tables.A('pk') because django-tables2 skips
rendering when the accessor resolves to None (inherited copies may
have pk=None in some contexts).

Tested: all 1092 existing tests pass.
@berlikm

berlikm commented Jul 14, 2026

Copy link
Copy Markdown
Author

This PR is part of the zero-touch provisioning feature set described in #121. Please see that issue for the full architecture and motivation.

berlikm added a commit to berlikm/nbxsync that referenced this pull request Jul 15, 2026
# Conflicts:
#	nbxsync/tables/zabbixserverassignment.py
@berlikm
berlikm force-pushed the fix/inherited-sync-status branch from 7f32c66 to 53e0aeb Compare July 16, 2026 07:33
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