Conversation
e39d16c to
32f0888
Compare
0c6268f to
6bbcb94
Compare
Commit history noteThis PR currently shows 24 commits because it includes stacked commits from dependencies (#115, #113, #123, #124). Once the dependency PRs are merged into The actual durable-binding delta (after dependencies land) consists of ~7 commits:
Full verification on the integration branch ( |
3d1a054 to
cacfcf1
Compare
Conflict resolution note for rebaseWhen rebasing this PR after #110 and #115 land, there will be two conflicts in Conflict 1: host_binding import (line ~14)
Correct resolution: Take this PR's version (the import is needed for durable bindings). Conflict 2: tag loop (line ~417)
Correct resolution: Combine all three concerns: exclude_tag = getattr(self.pluginsettings, 'exclude_tag', '')
for assigned_tag in (self.context.get('all_objects', {}).get('tags', []) or []):
if exclude_tag and assigned_tag.zabbixtag.tag == exclude_tag:
continue
value, _ = assigned_tag.render(object=sync_target)Important: The MigrationAfter rebasing, rename Verified in the integration-test branch: 1135 tests pass, E2E confirmed (create, sync, verify hostgroups/tags, delete, verify Zabbix removal). |
55c703f to
0d4cc5f
Compare
e9c476c to
d168320
Compare
b8f01ed to
75e2e6f
Compare
|
Added commit 2d1cf37 refining deletion semantics after review: Exclusion is explicit operator intent, so it is no longer gated by Rationale: the safety gate exists for inheritance-driven deletions a device owner cannot foresee (e.g. a Site moved into another SiteGroup silently stripping a server assignment). An Scope of the change:
Net effect with default settings: exclude tag, |
|
Added nested hostgroup support (commits 57b29a2 + 7fe6da3): parent-first group creation. Problem: Zabbix nesting is a name convention. Creating Fix: Tests: 4 new cases (creation order, idempotency, flat names untouched, malformed passthrough); |
…n and inherited sync UI Rebased onto 1.0.5 development (36fb2c4). Keeps Site/SiteGroup/Region/Tag assignment targets, recursive ancestry, exclude_tag, inherited sync status UI, and migrations 0013/0014. Takes 1.0.5 trigger-dependency settings (enabled=False by default), template pattern extraction, gettext_lazy, and CI pin to NetBox v4.6.7. Not in this PR: TemplateRule (#117), device-context render (#110), host bindings (#125), use_oob_ip (#129). Co-authored-by: berlikm <berlikm@users.noreply.github.com>
…g and API) Rebased onto 1.0.5 + #115. Unique TemplateRule surface, migration 0015, and inheritance matching. Query counts use the 1.0.5 NetBox v4.6.7 baselines plus TemplateRule views. Co-authored-by: berlikm <berlikm@users.noreply.github.com>
Rebased onto 1.0.5 + #115 + #117. Co-authored-by: berlikm <berlikm@users.noreply.github.com>
ee39eaf to
e0e5466
Compare
|
Restacked onto the 1.0.5 rebase of #110. Lifecycle-only: Trigger dependencies: 1.0.5's hook is preserved through the bindings rewrite. It still defaults to disabled, and it still runs once after the assignment loop (and after unassigned-binding retirement) — not inside the per-assignment loop, and not on excluded / VM / |
Add device/site/tenant/role/device_type/manufacturer shortcuts on tag and hostgroup templates. Aliases are derived from the final render object so host sync (object=Device/VM) uses the host, not the Role/Site assignment row. Hierarchy previews do not advertise a Site or Role as device. Co-authored-by: berlikm <berlikm@users.noreply.github.com>
e0e5466 to
15a496d
Compare
Generic FK context is equal by identity, not the same Python object. List previews walk site/role/device_type/manufacturer, so those two assignment list views run 28 queries instead of 20. Co-authored-by: berlikm <berlikm@users.noreply.github.com>
… safety gates Rebased onto 1.0.5 + #115 + #117 + #110. ZabbixHostBinding, migration 0016, allow_inherited_deletion/adopt_existing_hosts default off. Trigger-dependency sync stays after the assignment loop and remains disabled by default. Co-authored-by: berlikm <berlikm@users.noreply.github.com>
15a496d to
4ce50a3
Compare
After the first sync, ZabbixHostBinding holds the durable hostid and direct assignment.hostid is cleared. Ops views, HostInterfaceSync, and 1.0.5 trigger-dependency lookup still read assignment.hostid and skip zero-touch / already-synced hosts. Add get_managed_host_id / iter_managed_hosts (binding first, leftover direct assignment as fallback) and rewire those readers. Trigger dependencies stay disabled by default. Co-authored-by: berlikm <berlikm@users.noreply.github.com>
check_default_hostinterface treated "this host already has some default" as permission to create another interface as main=0. That is only valid when THIS host already has an interface of the SAME type whose default flag must be flipped. The first SNMP interface on a host that already has Agent must still be created as main=1; Zabbix allows one default per type, not one default per host. Production (all-in-one-1.0.5, hostsync.py:729) failed inherited ConfigGroup SNMP on SAP Agent+SNMP VMs with: No default interface for "SNMP" type The present-day remote state (Agent only) should have been skipped by the old "if not zbx_default: continue" guard. That guard is not a safe invariant: hostinterface.get without output=extend and without hostid filtering can record a default under the wrong type or from another host. find_by_name then correctly sees no local SNMP and the flip path creates SNMP as main=0. This is a HostSync bug, not a NetBox/template configuration problem. Allocated to upstream #125, which already owns check_default (inherited-clone save skip, binding hostid, reuse-existing-default). - Inventory this host with hostids=[] and output=extend - Ignore interfaces whose hostid is not this host - First-of-type create uses main=1 - main=0 only when this host already has that type - Promote a same-endpoint non-default instead of duplicating - find_by_name requests extend and a numeric type filter Co-authored-by: berlikm <berlikm@users.noreply.github.com>
Zabbix hostinterface.get can return a same-type same-ip match from a different host. find_by_name() now drops those candidates after the API call so first-of-type SNMP is created instead of being bound to the foreign interfaceid. Co-authored-by: berlikm <berlikm@users.noreply.github.com>
…signment PR #47 mapped extras.Tag to the shared assignment field name "tag" so Config Group assignments can target NetBox Tags. ZabbixHostInventory already uses that name for the Zabbix inventory tag CharField. clean() then saw device + tag="TAG" as two assignment targets and rejected create/edit with "can only be assigned to one object". Only ModelChoiceField pickers are assignment targets on this form. Co-authored-by: berlikm <berlikm@users.noreply.github.com>
Summary
Durable host bindings, background Device/VM reconciliation, and safety gates (#121).
Rebased onto 1.0.5 + #115 + #117 + #110. Depends on #110. Lifecycle-only delta:
https://github.com/berlikm/nbxsync/compare/fix/tag-render-device-context...fix/inherited-host-lifecycle
Highlights
ZabbixHostBinding— internal sync identity (no UI/API by design)allow_inherited_deletion/adopt_existing_hostsdefault off0016Scope frozen at tip
15a496d.Merge after: #110
Next: #129