Feature: Add Site/SiteGroup/Region to ConfigGroupAssignment form#116
Open
berlikm wants to merge 6 commits into
Open
Feature: Add Site/SiteGroup/Region to ConfigGroupAssignment form#116berlikm wants to merge 6 commits into
berlikm wants to merge 6 commits into
Conversation
This was referenced Jul 13, 2026
berlikm
force-pushed
the
feature/configgroup-site-form
branch
2 times, most recently
from
July 14, 2026 13:22
9e6f24b to
ccda6df
Compare
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
force-pushed
the
feature/configgroup-site-form
branch
from
July 14, 2026 14:34
ccda6df to
09afa8d
Compare
Fixes inherited Site/SiteGroup/Region assignments reading custom fields from the intermediate object instead of the actual Device/VM.
… in minimal.html - zabbixconfigurationgroupassignment.py: Add Site, SiteGroup, Region as DynamicModelChoiceField with FieldSet tabs and Meta.fields entries. Matches the pattern used by the other 6 assignment forms. - minimal.html: Add '+Add' buttons for Host Inventory and Configuration Group in the Miscellaneous panel. When no assignment exists, users see a blue Add button instead of just '-'. Links pre-fill assigned_object_type/id.
berlikm
force-pushed
the
feature/configgroup-site-form
branch
from
July 14, 2026 15:01
09afa8d to
b61f5d9
Compare
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
…gets # Conflicts: # nbxsync/forms/zabbixconfigurationgroupassignment.py
Adds ZabbixSyncBase._should_persist() returning False for transient inherited copies (those carrying _is_inherited_copy). Replaces the 4 inline getattr reads in syncbase.py and the 1 read in hostsync.py (_clear_direct_hostid / verify_hostinterfaces) with the helper call. Centralizes the persistence guard so a future change to the inherited-copy mechanism touches one method, not nine call sites. The model-level guard in sync_info.py:25 stays as the backstop. Adds two test_syncbase cases: _is_inherited_copy=True skips save() and update_sync_info(); absent/False runs them as before.
berlikm
force-pushed
the
feature/configgroup-site-form
branch
from
July 16, 2026 07:33
0ef0028 to
fbbc591
Compare
Author
Conflict resolution note for rebaseWhen rebasing this PR after #115 lands, there will be a conflict in
Correct resolution: Take this PR's version ( Verified in the integration-test branch: 1135 tests pass, E2E confirmed. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds Site, SiteGroup, and Region to the
ZabbixConfigurationGroupAssignmentform's assigned object target choices, so ConfigGroup interface templates can be assigned at the country/site-group level.Dependencies
Stacks on PR #115. Merge after #115.
Testing
All existing tests pass.
Part of #121.