Commit 16e538b1 authored by Daniel Salzman's avatar Daniel Salzman

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

fixes #578
parent 8bff1bfb
......@@ -494,8 +494,11 @@ int include_file(
}
// Evaluate include pattern.
ret = glob(path, 0, glob_error, &glob_buf);
if (ret != 0) {
switch (glob(path, 0, glob_error, &glob_buf)) {
case 0:
case GLOB_NOMATCH:
break;
default:
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", ".")
......
......@@ -1009,9 +1009,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