Commit 375f8a6c authored by Daniel Salzman's avatar Daniel Salzman

conf: don't fail if include pattern with no match

parent 4b8d1fab
......@@ -521,9 +521,9 @@ int include_file(
goto include_error;
}
// Evaluate include pattern.
// Evaluate include pattern (empty wildcard match is also valid).
ret = glob(path, 0, glob_error, &glob_buf);
if (ret != 0) {
if (ret != 0 && (ret != GLOB_NOMATCH || strchr(path, '*') == NULL)) {
ret = KNOT_EFILE;
goto include_error;
}
......
......@@ -16,6 +16,7 @@ ZONE3 = 'example.com.'
ZONE4 = 'zone4.'
knot = t.server("knot")
knot.include("/tmp/*.empty_include_match", None, empty=True)
knot.include(ZONE1 + "conf", ".")
knot.include("server.conf", ".")
knot.include("empty.conf", ".")
......
......@@ -1007,9 +1007,12 @@ class Knot(Server):
return dst_file
def include(self, file_name, storage=None):
dst_file = self.data_add(file_name, storage)
self.includes.add(dst_file)
def include(self, file_name, storage=None, empty=False):
if empty:
self.includes.add(file_name)
else:
dst_file = self.data_add(file_name, storage)
self.includes.add(dst_file)
def get_config(self):
s = dnstest.config.KnotConf()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment