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( ...@@ -494,8 +494,11 @@ int include_file(
} }
// Evaluate include pattern. // Evaluate include pattern.
ret = glob(path, 0, glob_error, &glob_buf); switch (glob(path, 0, glob_error, &glob_buf)) {
if (ret != 0) { case 0:
case GLOB_NOMATCH:
break;
default:
ret = KNOT_EFILE; ret = KNOT_EFILE;
goto include_error; goto include_error;
} }
......
...@@ -16,6 +16,7 @@ ZONE3 = 'example.com.' ...@@ -16,6 +16,7 @@ ZONE3 = 'example.com.'
ZONE4 = 'zone4.' ZONE4 = 'zone4.'
knot = t.server("knot") knot = t.server("knot")
knot.include("/tmp/*.empty_include_match", None, empty=True)
knot.include(ZONE1 + "conf", ".") knot.include(ZONE1 + "conf", ".")
knot.include("server.conf", ".") knot.include("server.conf", ".")
knot.include("empty.conf", ".") knot.include("empty.conf", ".")
......
...@@ -1009,9 +1009,12 @@ class Knot(Server): ...@@ -1009,9 +1009,12 @@ class Knot(Server):
return dst_file return dst_file
def include(self, file_name, storage=None): def include(self, file_name, storage=None, empty=False):
dst_file = self.data_add(file_name, storage) if empty:
self.includes.add(dst_file) self.includes.add(file_name)
else:
dst_file = self.data_add(file_name, storage)
self.includes.add(dst_file)
def get_config(self): def get_config(self):
s = dnstest.config.KnotConf() 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