Skip to content

Enforce has_feature filter for enabled_features checks#626

Open
ehelms wants to merge 2 commits into
theforeman:masterfrom
ehelms:enforce-has-feature-filter
Open

Enforce has_feature filter for enabled_features checks#626
ehelms wants to merge 2 commits into
theforeman:masterfrom
ehelms:enforce-has-feature-filter

Conversation

@ehelms

@ehelms ehelms commented Jul 7, 2026

Copy link
Copy Markdown
Member

Why are you introducing these changes? (Problem description, related links)

The has_feature Jinja2 filter handles feature membership correctly via exact match, prefix match (e.g. content/deb matching content), and transitive dependency resolution. Several places in the codebase were using raw 'x' in enabled_features checks instead, which bypasses prefix and dependency logic.

What are the changes introduced in this pull request?

  • Replace all 8 instances of 'x' in enabled_features with enabled_features | has_feature('x') across src/ and development/
  • Add a custom ansible-lint rule (use-has-feature-filter) to prevent regressions, checking task-level when clauses, role-level when clauses, and variable values

How to test this pull request

Steps to reproduce:

  • Run cd src && ansible-lint - should pass
  • Run cd development && ansible-lint - should pass
  • Temporarily revert a fix (e.g. change has_feature('iop') back to 'iop' in enabled_features in src/playbooks/deploy/deploy.yaml) and verify the rule flags it

Checklist

  • Tests added/updated (if applicable)
  • Documentation updated (if applicable)

ehelms and others added 2 commits July 6, 2026 18:03
Replace raw 'in enabled_features' checks with the has_feature filter
which correctly handles prefix matching and transitive dependencies.
Add a custom ansible-lint rule to prevent regressions.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant