Skip to content

Added sanitize_config_jinja activation for _substitute_lines - #298

Merged
jdrew82 merged 6 commits into
developfrom
u/joewesch-sanitize-config-jinja
Aug 13, 2026
Merged

Added sanitize_config_jinja activation for _substitute_lines#298
jdrew82 merged 6 commits into
developfrom
u/joewesch-sanitize-config-jinja

Conversation

@joewesch

@joewesch joewesch commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

This PR is a single portion of a larger plan to incorporate hashing as an alternative to string replacements in Golden Config.

Ref: nautobot/nautobot-app-golden-config#494

Full Plan

Step 1 - Plumbing (DONE)

We introduce a jinja-aware config sanitizer function to netutils. This new function looks for jinja templating in the replacement filter and crafts a callable that can be used to capture the group from the input text and pass it through the Jinja renderer, enabling the use of all existing filters (hash_data for this use case).

Step 2 - Activation (this step)

We update nornir-nautobot to use it in the same way we use sanitize_config:

        if any("{{" in item.get("replace", "") for item in substitute_lines):
            return sanitize_config_jinja(_running_config, substitute_lines)
        return sanitize_config(_running_config, substitute_lines)

We need to bump the minimum netutils version here to ensure it gets installed properly.

Step 3 - Documentation

With the change transparently activated in nornir-nautobot, we technically don't need to make any changes to Golden Config, but since this is the primary use case I intend to add detailed documentation and examples and bump the minimum version of nornir-nautobot here as well to ensure everything coalesces correctly.

@jdrew82
jdrew82 merged commit 3b2e972 into develop Aug 13, 2026
18 checks passed
@jdrew82
jdrew82 deleted the u/joewesch-sanitize-config-jinja branch August 13, 2026 13:33
This was referenced Aug 13, 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