{% extends 'admin/master.html' %}
{% block body %}
{% if host %}
{% with active='debug' %}
{% include 'admin/_host_tabs.html' with context %}
{% endwith %}
{% endif %}
{% if not host %}
Debug: {{ hostname or 'pick a host' }}
{% endif %}
{% if rule_preview_error %}
Rule preview: {{ rule_preview_error }}
{% endif %}
{% if rule_preview %}
{{ rule_preview.rule_type_label }} Preview — {{ rule_preview.rule_name }}
{% if rule_preview.match and rule_preview.match.hit %}
Rule matches this host
{% elif rule_preview.match and not rule_preview.match.hit %}
Rule would NOT match this host
{% else %}
What the export would render for this host
{% endif %}
{% if rule_preview.match and not rule_preview.match.hit %}
This rule does not match the current host — the
preview below is hypothetical: the export will skip this rule for
{{ hostname }}.
{% if rule_preview.match.no_match_reason %}
{% set nm = rule_preview.match.no_match_reason %}
First failing condition:
{% if nm.match_type == 'host' %}
hostname {{ nm.hostname }}
({{ nm.hostname_match }}{% if nm.hostname_match_negate %}, negated{% endif %})
{% else %}
tag {{ nm.tag }} = {{ nm.value }}
({{ nm.tag_match }} / {{ nm.value_match }})
{% endif %}
{% endif %}
{% endif %}
{% if not rule_preview.outcomes %}
This rule has no outcomes configured.
{% endif %}
{% for o in rule_preview.outcomes %}
{{ o.title }}
{% if o.meta %}{{ o.meta }}{% endif %}
{% if o.note %}
{{ o.note }}
{% endif %}
{% if o.rows %}
{% for label, value in o.rows %}
| {{ label }} |
{{ value }} |
{% endfor %}
{% endif %}
{% endfor %}
{% endif %}
{% if output is mapping %}
{% set outcomes = output.get('Outcomes') %}
{% set filtered = output.get('Filtered') %}
{% set custom = output.get('Custom Attributes') %}
{% set full_attrs = output.get('Full Attribute List') %}
{% set disabled_info = output.get('Info: Host disabled by Filter', 'MISSING') %}
{% macro render_kv(items) %}
{% if items %}
{% for k, v in items.items() %}
{{ k }}
{{ v }}
{% endfor %}
{% else %}
No entries.
{% endif %}
{% endmacro %}
{# --- Primary summary: Outcomes + Filtered, both expanded --- #}
Outcomes
Actions that will fire for this host
{% if outcomes is mapping %}
{{ render_kv(outcomes) }}
{% elif outcomes %}
{{ outcomes }}
{% else %}
{% if disabled_info != 'MISSING' %}
Host is disabled by a filter rule — no outcome is produced. See the Rules section below.
{% else %}
No outcome data for this host.
{% endif %}
{% endif %}
Filtered Labels
After filter / rewrite rules
{{ render_kv(filtered) if filtered else '
No filter/rewrite rules apply — same as full attribute list below.
' | safe }}
{# --- Custom Attributes, only when present --- #}
{% if custom %}
Custom Attributes
From CustomAttributeRule
{{ render_kv(custom) }}
{% endif %}
{# --- Rules drill-down (collapsed accordion by rule group) --- #}
{% if rules %}
{% set condition_types = {
'equal': "exact match", 'in': "contains", 'not_in': "not contains",
'in_list': "value in your list", 'string_in_list': "string in Python list",
'ewith': "ends with", 'swith': "starts with", 'regex': "regex match",
'bool': "boolean match", 'ignore': "always match"
} %}
{% set negate = { true: 'not ', false: ' ' } %}
Rules
Per-rule match details (click a group to expand)
{% for rule_name, rule_raw in rules.items() %}
| Rule |
Hit |
First reason the rule won't match |
Condition Type |
Last Match |
{% for rule in rule_raw %}
|
{% if rule['rule_url'] %}
{{ rule['name'] }}
{% else %}
{{ rule['name'] }}
{% endif %}
|
{% if rule['hit'] %}
{% else %}
{% endif %}
|
{% if rule['no_match_reason'] %}
{% set no_match = rule['no_match_reason'] %}
{% if no_match['match_type'] == 'host' %}
{{ negate[no_match['hostname_match_negate']] }}{{ condition_types[no_match['hostname_match']] }}
{{ no_match['hostname'] }}
{% else %}
{{ negate[no_match['tag_match_negate']] }}{{ condition_types[no_match['tag_match']] }}
{{ no_match['tag'] }}
=
{{ negate[no_match['value_match_negate']] }}{{ condition_types[no_match['value_match']] }}
{{ no_match['value'] }}
{% endif %}
{% endif %}
|
{{ rule['condition_type'] }} |
{{ rule['last_match'] }} |
{% endfor %}
{% endfor %}
{% endif %}
{# --- Full Attribute List (collapsed by default) --- #}
{% if full_attrs %}
Full Attribute List (raw)
All host labels before filter — click to expand
{{ render_kv(full_attrs) }}
{% endif %}
{% elif hostname %}
{{ output }}
{% endif %}
{% endblock %}