File tree Expand file tree Collapse file tree
notifications/templates/mail Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ [ // ] : # ( werk v2 )
2+ # Notifications: handle undefined mail variables
3+
4+ key | value
5+ ---------- | ---
6+ date | 2025-10-21T08:52:12+00:00
7+ version | 2.5.0b1
8+ class | fix
9+ edition | cre
10+ component | notifications
11+ level | 1
12+ compatible | yes
13+
14+ Mail notifications failed when the following variables were undefined:
15+
16+ - ` PREVIOUSHOSTHARDSTATE `
17+ - ` PREVIOUSSERVICEHARDSTATE `
18+
19+ These variables now default to ` UNKNOWN ` when undefined.
20+
21+ No action is required from users to benefit from this improvement.
Original file line number Diff line number Diff line change 2929 <td style =" padding : 0 ; vertical-align : middle ;" >
3030 <div class =" mobile_event_marker_bulk"
3131 style =" {{ macros .event _marker _bulk _style () }};
32- {% if service _notification %} {{ state _mapping [entry .PREVIOUSSERVICEHARDSTATE ] }} {% else %} {{ state _mapping [entry .PREVIOUSHOSTHARDSTATE ] }} {% endif %};
32+ {% if service _notification %} {{ state _mapping [( entry .PREVIOUSSERVICEHARDSTATE | default ( " UNKNOWN " ) ) ] }} {% else %} {{ state_mapping[( entry.PREVIOUSHOSTHARDSTATE|default( " UNKNOWN " ) ) ] }} {% endif %};
3333 display: inline-block;
3434 /* Inline block to respect width */" >
3535 {% if service_notification %}
36- {{ entry.PREVIOUSSERVICEHARDSTATE[:4] }}
36+ {{ ( entry.PREVIOUSSERVICEHARDSTATE|default("UNKNOWN") ) [:4] }}
3737 {% else %}
38- {{ entry.PREVIOUSHOSTHARDSTATE[:4] }}
38+ {{ ( entry.PREVIOUSHOSTHARDSTATE|default("UNKNOWN") ) [:4] }}
3939 {% endif %}
4040 </div >
4141 </td >
Original file line number Diff line number Diff line change 3333 <tr >
3434 <td style =" line-height : 45px ; padding : 0 ; " >
3535 <div style =" {{ macros .event _marker _style () }};
36- {% if service _notification %} {{ state _mapping [data .PREVIOUSSERVICEHARDSTATE ] }} {% else %} {{ state _mapping [data .PREVIOUSHOSTHARDSTATE ] }} {% endif %};
36+ {% if service _notification %} {{ state _mapping [( data .PREVIOUSSERVICEHARDSTATE | default ( " UNKNOWN " ) ) ] }} {% else %} {{ state_mapping[( data.PREVIOUSHOSTHARDSTATE|default( " UNKNOWN " ) ) ] }} {% endif %};
3737 display: inline-block;
3838 /* Inline block to respect width */" >
3939 {% if service_notification %}
40- {{ data.PREVIOUSSERVICEHARDSTATE[:4] }}
40+ {{ ( data.PREVIOUSSERVICEHARDSTATE|default("UNKNOWN") ) [:4] }}
4141 {% else %}
42- {{ data.PREVIOUSHOSTHARDSHORTSTATE[:4] }}
42+ {{ ( data.PREVIOUSHOSTHARDSHORTSTATE|default("UNKNOWN") ) [:4] }}
4343 {% endif %}
4444 </div >
4545 </td >
You can’t perform that action at this time.
0 commit comments