Skip to content

Commit 1ce4378

Browse files
committed
Deprecation check and test fixup
Add a deprecation message if enable_logging is used instead of enable_query_log. Abort if both enable_logging/enable_query_log is enabled with use_extensive_logging as these are mutually exclusive now. Fixup tests to _not_ look for the querylog line.
1 parent 5685a5e commit 1ce4378

File tree

4 files changed

+16
-3
lines changed

4 files changed

+16
-3
lines changed

bind/config.sls

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,18 @@ bind_config:
8383
- watch_in:
8484
- service: bind
8585
86+
{%- if salt['pillar.get']('bind:config:enable_logging') is not none %}
87+
bind_local_config_deprecated_logging:
88+
test.show_notification:
89+
- text: Pillar data contains enable_logging. This parameter is deprecated and has been renamed enable_query_log.
90+
{%- endif %}
91+
92+
{%- if (salt['pillar.get']('bind:config:enable_logging') or salt['pillar.get']('bind:config:enable_query_log')) and salt['pillar.get']('bind:config:use_extensive_logging') %}
93+
bind_local_config_logging_extensive_fail:
94+
test.fail_without_changes:
95+
- name: Pillar data uses enable_logging/enable_query_log and use_extensive_logging. These are mutually exclusive.
96+
{%- endif %}
97+
8698
bind_local_config:
8799
file.managed:
88100
- name: {{ map.local_config }}

bind/files/named.conf.local.jinja

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,8 @@ view {{ view }} {
134134

135135
{%- if salt['pillar.get']('bind:config:use_extensive_logging', False) %}
136136
include "{{ map.logging_config }}";
137-
{% elif salt['pillar.get']('bind:config:enable_logging', False) %}
137+
{#- bind:config:enable_logging is deprecated. TODO: Remove the or part of the condition below after a while. #}
138+
{% elif salt['pillar.get']('bind:config:enable_query_log', False) or salt['pillar.get']('bind:config:enable_logging', False) %}
138139
logging {
139140
channel "querylog" {
140141
file "{{ map.log_dir }}/query.log";

pillar.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ bind:
2828
user: root # File & Directory user
2929
group: named # File & Directory group
3030
mode: 640 # File & Directory mode
31-
enable_logging: true # Enable basic query logging in $log_dir/query.log
31+
enable_query_log: true # Enable basic query logging in $log_dir/query.log
3232
use_extensive_logging: # Alternatively, enable much more extensive config for logging.
3333
channel: # Partial example. For proposed settings please refer to
3434
default_log: # https://kb.isc.org/article/AA-01526/0/BIND-Logging-some-basic-recommendations.html

test/integration/default/config_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@
147147
# Match 100.51.198 reverse zone from pillar
148148
its('content') { should match /^zone\ "100\.51\.198\.in-addr\.arpa"\ {\n\ \ type\ master;\n\ \ file\ "#{zones_directory}\/100\.51\.198\.in-addr\.arpa";\n\ \ \n\ \ notify\ no;\n\};/ }
149149
# Match logging
150-
its('content') { should match /^logging\ \{\n\ \ channel\ "querylog"\ {\n\ \ \ \ file\ "#{log_directory}\/query\.log";\n\ \ \ \ print-time\ yes;\n\ \ \};\n\ \ category\ queries\ \{\ querylog;\ \};\n\};/ }
150+
its('content') { should_not match /^logging\ \{\n\ \ channel\ "querylog"\ {\n\ \ \ \ file\ "#{log_directory}\/query\.log";\n\ \ \ \ print-time\ yes;\n\ \ \};\n\ \ category\ queries\ \{\ querylog;\ \};\n\};/ }
151151
# Match acl1
152152
its('content') { should match /acl\ client1\ \{\n\ \ 127\.0\.0\.0\/8;\n\ \ 10\.20\.0\.0\/16;\n\};/ }
153153
# Match acl2

0 commit comments

Comments
 (0)