]> git.ipfire.org Git - thirdparty/knot-dns.git/commitdiff
knotc: add common modules loading before conf_import
authorDaniel Salzman <daniel.salzman@nic.cz>
Thu, 14 Sep 2023 11:50:15 +0000 (13:50 +0200)
committerDaniel Salzman <daniel.salzman@nic.cz>
Fri, 15 Sep 2023 12:22:22 +0000 (14:22 +0200)
fixes #881

src/utils/knotc/commands.c

index a4afe834cd43813d59976a245eb10c8b0379f27d..da1876b74a8cf19af5c13a563f51f61ea2539dee 100644 (file)
@@ -23,6 +23,7 @@
 #include "knot/ctl/commands.h"
 #include "knot/conf/conf.h"
 #include "knot/conf/confdb.h"
+#include "knot/conf/module.h"
 #include "knot/conf/tools.h"
 #include "knot/zone/zonefile.h"
 #include "knot/zone/zone-load.h"
@@ -1126,13 +1127,17 @@ static int cmd_conf_import(cmd_args_t *args)
                        return KNOT_EDENIED;
                }
 
-               log_debug("importing confdb from file '%s'", args->argv[0]);
-
                // Import to a cloned conf to avoid external module conflict.
                conf_t *new_conf = NULL;
                ret = conf_clone(&new_conf);
                if (ret == KNOT_EOK) {
-                       ret = conf_import(new_conf, args->argv[0], true, false);
+                       yp_schema_purge_dynamic(new_conf->schema);
+                       log_debug("loading modules for imported configuration");
+                       ret = conf_mod_load_common(new_conf);
+                       if (ret == KNOT_EOK) {
+                               log_debug("importing confdb from file '%s'", args->argv[0]);
+                               ret = conf_import(new_conf, args->argv[0], true, false);
+                       }
                        conf_free(new_conf);
                }
        }