Skip to content

Add j2lint and cleanup Jinja2 templates#56

Open
petercrocker wants to merge 3 commits intomainfrom
j2lint-rebased
Open

Add j2lint and cleanup Jinja2 templates#56
petercrocker wants to merge 3 commits intomainfrom
j2lint-rebased

Conversation

@petercrocker
Copy link
Contributor

Summary

  • Adds j2lint as a dev dependency for Jinja2 template linting
  • Standardizes formatting across all 21 Jinja2 templates:
    • Consistent whitespace control with hyphens
    • Built-in Jinja2 filters instead of .split("/")[0]
    • Standardized indentation and block formatting

Rebased version of #32 by @ryanmerolle — the original branch was stale (pinned to infrahub-testcontainers 1.6.1 vs 1.7.7 on main), which caused the integration test to fail with CoreGraphQLQueryGroup ID mismatches during proposed change merge.

Test plan

  • Integration test test_13_merge_proposed_change passes (was failing on add j2lint & cleanup jinja templates #32)
  • Generated device configs are functionally identical (changes are whitespace-only)
  • j2lint runs cleanly against all templates

Rebased version of PR #32 from ryanmerolle. Adds j2lint dependency
and standardizes Jinja2 template formatting across all templates:
- Consistent whitespace control with hyphens
- Use built-in Jinja2 filters instead of .split("/")[0]
- Standardized indentation and block formatting

Original author: Ryan Merolle <ryan.merolle@gmail.com>
@petercrocker petercrocker requested a review from a team as a code owner March 13, 2026 23:52
@petercrocker
Copy link
Contributor Author

FYI this is the replacement PR @ryanmerolle

PR #34 added manufacturer to DcimDeviceType human_friendly_id but did
not update the object YAML files that reference device types. All
device_type relationship fields now use [Manufacturer, Name] format
to match the two-part HFID.
@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Mar 14, 2026

Deploying infrahub-demo with  Cloudflare Pages  Cloudflare Pages

Latest commit: b51a9c0
Status: ✅  Deploy successful!
Preview URL: https://85bd7e62.infrahub-demo.pages.dev
Branch Preview URL: https://j2lint-rebased.infrahub-demo.pages.dev

View logs

The j2lint PR replaced .split('/')[0] with ipaddress_interface(attr='ip')
but this filter does not exist in Infrahub's Jinja2 environment, causing
TransformError during artifact generation.
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