- Instead of strings to be replaced by sed, use proper jinja templates.
- ns3/named1.conf.j2 is basically a copy of the default config, because
it needs to be restored later in the test.
* information regarding copyright ownership.
*/
+{% set server_config_use_addr = server_config_use_addr | default(False) %}
+
key rndc_key {
secret "1234abcd8765";
algorithm @DEFAULT_HMAC@;
zone "example.org" {
type static-stub;
- SERVER_CONFIG_PLACEHOLDER
+{% if server_config_use_addr %}
+ server-addresses { 10.53.0.4; };
+{% else %}
+ server-names { "ns.example.net"; };
+{% endif %}
};
zone "example.info" {
--- /dev/null
+/*
+ * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
+ *
+ * SPDX-License-Identifier: MPL-2.0
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, you can obtain one at https://mozilla.org/MPL/2.0/.
+ *
+ * See the COPYRIGHT file distributed with this work for additional
+ * information regarding copyright ownership.
+ */
+
+{% set server_config_use_addr = True %}
+
+{% include "ns2/named.conf.j2" %}
* information regarding copyright ownership.
*/
+{% set example_zone = example_zone | default(True) %}
+
key rndc_key {
secret "1234abcd8765";
algorithm @DEFAULT_HMAC@;
notify no;
};
-EXAMPLE_ZONE_PLACEHOLDER
+{% if example_zone %}
+zone "example" {
+ type primary;
+ file "example.db.signed";
+};
+{% endif %}
zone "example.org" {
type primary;
--- /dev/null
+/*
+ * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
+ *
+ * SPDX-License-Identifier: MPL-2.0
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, you can obtain one at https://mozilla.org/MPL/2.0/.
+ *
+ * See the COPYRIGHT file distributed with this work for additional
+ * information regarding copyright ownership.
+ */
+
+{% set example_zone = True %}
+
+{% include "ns3/named.conf.j2" %}
--- /dev/null
+/*
+ * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
+ *
+ * SPDX-License-Identifier: MPL-2.0
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, you can obtain one at https://mozilla.org/MPL/2.0/.
+ *
+ * See the COPYRIGHT file distributed with this work for additional
+ * information regarding copyright ownership.
+ */
+
+{% set example_zone = False %}
+
+{% include "ns3/named.conf.j2" %}
. ../conf.sh
-copy_setports ns1/named.conf.in ns1/named.conf
-copy_setports ns2/named.conf.in tmp
-sed 's/SERVER_CONFIG_PLACEHOLDER/server-names { "ns.example.net"; };/' tmp >ns2/named.conf
-
-copy_setports ns3/named.conf.in tmp
-sed 's/EXAMPLE_ZONE_PLACEHOLDER/zone "example" { type primary; file "example.db.signed"; };/' tmp >ns3/named.conf
-
-copy_setports ns4/named.conf.in ns4/named.conf
-
cd ns3 && $SHELL -e sign.sh
$DIG $DIGOPTS +tcp data1.sub.example. @10.53.0.2 txt >dig.out.ns2.test1.$n || ret=1
grep "1st sub test data" dig.out.ns2.test1.$n >/dev/null || ret=1
# temporarily disable the the parent zone
-copy_setports ns3/named.conf.in tmp
-sed 's/EXAMPLE_ZONE_PLACEHOLDER//' tmp >ns3/named.conf
+cp ns3/named2.conf ns3/named.conf
rndc_reload ns3 10.53.0.3
# query the child zone again. this should directly go to the child and
# succeed.
done
grep "2nd sub test data" dig.out.ns2.test2.$n >/dev/null || ret=1
# re-enable the parent
-copy_setports ns3/named.conf.in tmp
-sed 's/EXAMPLE_ZONE_PLACEHOLDER/zone "example" { type primary; file "example.db.signed"; };/' tmp >ns3/named.conf
+cp ns3/named1.conf ns3/named.conf
rndc_reload ns3 10.53.0.3
if [ $ret != 0 ]; then echo_i "failed"; fi
status=$((status + ret))
n=$((n + 1))
echo_i "checking server reload with a different static-stub config ($n)"
ret=0
-copy_setports ns2/named.conf.in tmp
-sed 's/SERVER_CONFIG_PLACEHOLDER/server-addresses { 10.53.0.4; };/' tmp >ns2/named.conf
+cp ns2/named2.conf ns2/named.conf
rndc_reload ns2 10.53.0.2
$DIG $DIGOPTS +tcp data2.example.org. @10.53.0.2 txt >dig.out.ns2.test$n || ret=1
grep "2nd example org data" dig.out.ns2.test$n >/dev/null || ret=1