]> git.ipfire.org Git - thirdparty/knot-dns.git/commitdiff
keymgr: new -D param instead of deprecated -d
authorLibor Peltan <libor.peltan@nic.cz>
Mon, 2 Aug 2021 16:30:21 +0000 (18:30 +0200)
committerDaniel Salzman <daniel.salzman@nic.cz>
Tue, 7 Sep 2021 13:38:21 +0000 (15:38 +0200)
doc/man/keymgr.8in
doc/man_keymgr.rst
src/utils/keymgr/functions.h
src/utils/keymgr/main.c
tests-extra/tests/catalog/basic/test.py
tests-extra/tests/catalog/groups/test.py

index de786632fcfd4557ef79e0f67fd87d5e773cefb7..31ed7fcdc3790006f22cda1940a4747e85ca2961 100644 (file)
@@ -83,7 +83,7 @@ Use a binary configuration database directory (default is \fB@storage_dir@/confd
 The default configuration database, if exists, has a preference to the default
 configuration file.
 .TP
-\fB\-d\fP, \fB\-\-dir\fP \fIpath\fP
+\fB\-D\fP, \fB\-\-dir\fP \fIpath\fP
 Use specified KASP database path and default configuration.
 .UNINDENT
 .sp
index 19844bc0d3b31df07c7eb5cfa5178c3a16f48bbb..0c0dc11879bbd37ae18fefa3793a1a1beab7a0fd 100644 (file)
@@ -60,7 +60,7 @@ Config options
   The default configuration database, if exists, has a preference to the default
   configuration file.
 
-**-d**, **--dir** *path*
+**-D**, **--dir** *path*
   Use specified KASP database path and default configuration.
 
 .. NOTE::
index 398088543fef0fd976153bc5acb17611a3226029..277cfc44869130d69836d22151152ba049a7be06 100644 (file)
@@ -20,7 +20,8 @@
 
 #include "knot/dnssec/context.h"
 
-#define ERROR(msg, ...)        { fprintf(stderr, "Error: " msg, ##__VA_ARGS__); fflush(stderr); }
+#define ERROR(msg, ...)   { fprintf(stderr, "Error: " msg, ##__VA_ARGS__); fflush(stderr); }
+#define WARNING(msg, ...) { fprintf(stderr, "Warning: " msg, ##__VA_ARGS__); fflush(stderr); }
 
 typedef struct {
        knot_time_print_t format;
index 015603d738448cf57f09c6010fbaa1506567feed..bc24b787cc0f96fe2d0ba76c27270ce1d37b310d 100644 (file)
@@ -47,7 +47,7 @@ static void print_help(void)
               "                            (default %s)\n"
               "  -C, --confdb <dir>       Use a binary configuration database directory.\n"
               "                            (default %s)\n"
-              "  -d, --dir <path>         Use specified KASP database path and default configuration.\n"
+              "  -D, --dir <path>         Use specified KASP database path and default configuration.\n"
               "  -t, --tsig <name> [alg]  Generate a TSIG key.\n"
               "  -l, --list               List all zones that have at least one key in KASP database.\n"
               "  -x, --mono               Don't color the output.\n"
@@ -369,7 +369,7 @@ int main(int argc, char *argv[])
        struct option opts[] = {
                { "config",  required_argument, NULL, 'c' },
                { "confdb",  required_argument, NULL, 'C' },
-               { "dir",     required_argument, NULL, 'd' },
+               { "dir",     required_argument, NULL, 'D' },
                { "tsig",    required_argument, NULL, 't' },
                { "brief",   no_argument,       NULL, 'b' },
                { "list",    no_argument,       NULL, 'l' },
@@ -389,7 +389,7 @@ int main(int argc, char *argv[])
        list_params.color = isatty(STDOUT_FILENO);
 
        int opt = 0, parm = 0;
-       while ((opt = getopt_long(argc, argv, "hVd:c:C:t:lbxX", opts, NULL)) != -1) {
+       while ((opt = getopt_long(argc, argv, "hVd:D:c:C:t:lbxX", opts, NULL)) != -1) {
                switch (opt) {
                case 'h':
                        print_help();
@@ -398,6 +398,9 @@ int main(int argc, char *argv[])
                        print_version(PROGRAM_NAME);
                        return EXIT_SUCCESS;
                case 'd':
+                       WARNING("keymgr -d is deprecated, use -D option instead\n");
+                       // FALLTHROUGH
+               case 'D':
                        CHECK_CONF_UNINIT
                        if (!init_conf(NULL) || !init_conf_blank(optarg)) {
                                return EXIT_FAILURE;
@@ -450,7 +453,7 @@ int main(int argc, char *argv[])
                           init_conf(NULL) && init_confile(CONF_DEFAULT_FILE)) {
                        // initialized conf from default confile
                } else {
-                       ERROR("couldn't initialize configuration, please provide -c, -C, or -d option\n");
+                       ERROR("couldn't initialize configuration, please provide -c, -C, or -D option\n");
                        return EXIT_FAILURE;
                }
        }
index b4b1920a1bf31fcb870c755ed1c88aed183e93d9..80f6abbf31ffd77ea78d2d7fd269bda298676542 100644 (file)
@@ -14,7 +14,7 @@ import subprocess
 import random
 
 def check_keys(server, zone_name, expect_keys):
-    cmd = Popen([dnstest.params.keymgr_bin, "-d", server.dir + "/keys", zone_name, "list"], stdout=PIPE, stderr=PIPE, universal_newlines=True)
+    cmd = Popen([dnstest.params.keymgr_bin, "-D", server.dir + "/keys", zone_name, "list"], stdout=PIPE, stderr=PIPE, universal_newlines=True)
     (stdout, stderr) = cmd.communicate()
     lines = len(stdout.splitlines())
     if lines != expect_keys:
index 764e1d3a50b46e67eebab263a1e026a2292ea566..9ef9705b40b31894579a53bf5900f82450d3c118 100644 (file)
@@ -14,7 +14,7 @@ import subprocess
 import random
 
 def check_keys(server, zone_name, expect_keys):
-    cmd = Popen([dnstest.params.keymgr_bin, "-d", server.dir + "/keys", zone_name, "list"], \
+    cmd = Popen([dnstest.params.keymgr_bin, "-D", server.dir + "/keys", zone_name, "list"], \
                 stdout=PIPE, stderr=PIPE, universal_newlines=True)
     (stdout, stderr) = cmd.communicate()
     lines = len(stdout.splitlines())