diff --git a/CHANGELOG.md b/CHANGELOG.md index aabffb88..1a4d3fc0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,8 @@ BUG FIXES: -Dictionaries are a sequence per Jinja2 contrary to Python's defaults (dictionaries are not a sequence in Python). The template conditionals assumed the latter. +* Dictionaries are a sequence per Jinja2 contrary to Python's defaults (dictionaries are not a sequence in Python). The template conditionals assumed the latter. +* NAP DoS monitor directive would fail if some variables were commented out. ## 0.4.1 (October 25, 2021) diff --git a/templates/http/app_protect.j2 b/templates/http/app_protect.j2 index 1e5e27e4..cc30df9d 100644 --- a/templates/http/app_protect.j2 +++ b/templates/http/app_protect.j2 @@ -60,10 +60,8 @@ app_protect_dos_policy_file {{ app_protect_dos['policy_file'] }}; {% if app_protect_dos['name'] is defined %} app_protect_dos_name {{ app_protect_dos['name'] }}; {% endif %} -{% if app_protect_dos['monitor'] is defined and app_protect_dos['monitor'] is mapping %} -app_protect_dos_monitor uri={{ app_protect_dos['monitor']['uri'] | ternary(app_protect_dos['monitor']['uri'], app_protect_dos['monitor']) }}{{ app_protect_dos['monitor']['protocol'] | ternary((' protocol=' + app_protect_dos['monitor']['protocol'] | string), '') }}{{ app_protect_dos['monitor']['timeout'] | ternary((' timeout=' + app_protect_dos['monitor']['timeout'] | string), '') }}; -{% elif app_protect_dos['monitor'] is defined and app_protect_dos['monitor'] is string %} -app_protect_dos_monitor {{ app_protect_dos['monitor'] }}; +{% if app_protect_dos['monitor'] is defined %} +app_protect_dos_monitor {{ app_protect_dos['monitor'] if app_protect_dos['monitor'] is string }}{{ ('uri=' + app_protect_dos['monitor']['uri'] | string) if app_protect_dos['monitor']['uri'] is defined }}{{ (' protocol=' + app_protect_dos['monitor']['protocol'] | string) if app_protect_dos['monitor']['protocol'] is defined }}{{ (' timeout=' + app_protect_dos['monitor']['timeout'] | string) if app_protect_dos['monitor']['timeout'] is defined }}; {% endif %} {% if app_protect_dos['security_log_enable'] is defined and app_protect_dos['security_log_enable'] is boolean %} app_protect_dos_security_log_enable {{ app_protect_dos['security_log_enable'] | ternary('on', 'off') }};