Skip to content

add j2lint & cleanup jinja templates#32

Closed
ryanmerolle wants to merge 10 commits intoopsmill:mainfrom
ryanmerolle:j2lint
Closed

add j2lint & cleanup jinja templates#32
ryanmerolle wants to merge 10 commits intoopsmill:mainfrom
ryanmerolle:j2lint

Conversation

@ryanmerolle
Copy link
Contributor

Waiting on feedback for opsmill/infrahub#8182 to further reduce template noise gven the usage of hyphens to address whitespace issues.

@ryanmerolle ryanmerolle requested a review from a team as a code owner January 21, 2026 01:55
@petercrocker
Copy link
Contributor

Hey @ryanmerolle this is failing an integration test:

Primary failure: No filter named 'ipaddress_interface'

jinja2.exceptions.TemplateAssertionError: No filter named 'ipaddress_interface'.
The PR replaced all instances of .split('/')[0] (vanilla Jinja2 string manipulation to strip CIDR prefix from IPs like 10.0.0.1/32 → 10.0.0.1) with | ipaddress_interface(attr='ip'). This filter comes from the netutils library but is not registered in Infrahub's Jinja2 environment, so the templates fail at render time.

This cascades into the final test failure:

FAILED tests/integration/test_workflow.py::TestDCWorkflow::test_13_merge_proposed_change
The proposed change couldn't merge because the transforms (which render these templates) were all failing.

petercrocker added a commit that referenced this pull request Mar 13, 2026
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
Copy link
Contributor

Closing in favor of #56 which rebases this work onto current main. The integration test failure was caused by stale dependency versions (infrahub-testcontainers 1.6.1 vs 1.7.7). Thank you @ryanmerolle for the original contribution!

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.

3 participants