Skip to content

fix(render): device-context tag/hostgroup rendering and UI previews - #110

Closed
berlikm wants to merge 5 commits into
OpensourceICTSolutions:developmentfrom
berlikm:fix/tag-render-device-context
Closed

berlikm wants to merge 5 commits into
OpensourceICTSolutions:developmentfrom
berlikm:fix/tag-render-device-context

Conversation

@berlikm

@berlikm berlikm commented Jul 13, 2026 •

Copy link
Copy Markdown

Summary

Device/VM context for Jinja2 tag & hostgroup rendering, plus UI previews (#121).

Rebased onto 1.0.5 + #115 + #117. Depends on #117. Render-only delta:

https://github.com/berlikm/nbxsync/compare/feature/templaterule-regex...fix/tag-render-device-context

Also covers #102: tag/hostgroup templates get device, site, tenant, role, device_type, and manufacturer aliases. Those keys are filled from the render object (the Device/VM during host sync), not from the assignment row — so a Role-level template rendered with object=<host> uses that host's site/role. device is only set for Device/VM/VDC; a Site assignment is not advertised as device.

Scope frozen at tip c46ed48.

Merge after: #117
Next: #125

@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
berlikm force-pushed the fix/tag-render-device-context branch from dc2cc0b to 89c8533 Compare July 16, 2026 07:33
@berlikm

berlikm commented Jul 16, 2026

Copy link
Copy Markdown
Author

Conflict resolution note for rebase

When rebasing this PR after #115 lands, there will be a conflict in nbxsync/utils/sync/hostsync.py on the tag loop line:

Correct resolution: Take #115's version (or [] normalization). This PR's render(object=sync_target) on the line below merges cleanly — no conflict there.

Verified in the integration-test branch: 1135 tests pass, E2E confirmed.

@cursor
cursor Bot force-pushed the fix/tag-render-device-context branch from e0cbff2 to 9e5ad73 Compare July 30, 2026 23:15
@berlikm berlikm changed the title Fix: Pass device context to tag render for Jinja2 values fix(render): device-context tag/hostgroup rendering and UI previews Jul 30, 2026
@cursor
cursor Bot force-pushed the fix/tag-render-device-context branch 4 times, most recently from f87e5e1 to 34c4916 Compare July 31, 2026 09:24
@cursor
cursor Bot force-pushed the fix/tag-render-device-context branch from 34c4916 to 40fad32 Compare July 31, 2026 11:08
cursoragent and others added 3 commits August 14, 2026 11:43
…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>
@berlikm

berlikm commented Aug 14, 2026

Copy link
Copy Markdown
Author

Restacked onto the 1.0.5 rebase of #117.

Render-only: device/VM context for Jinja2 tag & hostgroup values, plus UI previews. No change to trigger-dependency behaviour from 1.0.5 (enabled=False by default; hook once after the assignment loop).

Scope frozen at 31d8d6e. Merge after #117; next is #125.

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>
@berlikm

berlikm commented Aug 14, 2026

Copy link
Copy Markdown
Author

Follow-up on the 1.0.5 rebase: #102's related-object Jinja aliases are now in this PR (c46ed48).

device / site / tenant / role / device_type / manufacturer are derived from the final render object (the host during sync), not from the assignment row. That way a Role-level template still uses the Device being synced, which #102's device = assigned_object would have gotten wrong for inherited assignments.

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>
@berlikm berlikm closed this Sep 11, 2026
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.

2 participants