On Thu, Sep 24, 2015 at 05:05:34PM +0200, Patrick Ben Koetter wrote:

> > That can happen.  We could test more pre-conditions, but ultimately,
> > the administrator may need to recover from situations where automated
> > deletion is risky.
> 
> Agreed. I wouldn't reach out to test any thinkable situation. The problem I
> ran into seemed worth to test - at least to me.

The patch below adds a test for the proto files (and repeats
the previously posted correction to the "-e" usage message).

diff --git a/conf/postmulti-script b/conf/postmulti-script
index 349c894..b1aea8e 100644
--- a/conf/postmulti-script
+++ b/conf/postmulti-script
@@ -142,6 +142,11 @@ create|import)
                fatal "'$config_directory' lacks a master.cf file"
        }
 
+       test -f $meta_directory/main.cf.proto ||
+           fatal "Missing main.cf prototype: $meta_directory/main.cf.proto"
+       test -f $meta_directory/master.cf.proto ||
+           fatal "Missing master.cf prototype: $meta_directory/master.cf.proto"
+
        # Create instance-specific directories
        #
        test -d $config_directory ||
diff --git a/src/postmulti/postmulti.c b/src/postmulti/postmulti.c
index 0d124ae..8fdc231 100644
--- a/src/postmulti/postmulti.c
+++ b/src/postmulti/postmulti.c
@@ -1711,7 +1711,7 @@ int     main(int argc, char **argv)
        case 'e':
            if ((code = EDIT_CMD_CODE(optarg)) < 0)
                msg_fatal("Invalid '-e' edit action '%s'. Specify '%s', "
-                         "'%s', '%s', '%s', '%s', '%s', '%s', '%s' or '%s'",
+                         "'%s', '%s', '%s', '%s', '%s', '%s' or '%s'",
                          optarg,
                          EDIT_CMD_STR(EDIT_CMD_CREATE),
                          EDIT_CMD_STR(EDIT_CMD_DESTROY),
@@ -1720,8 +1720,7 @@ int     main(int argc, char **argv)
                          EDIT_CMD_STR(EDIT_CMD_ENABLE),
                          EDIT_CMD_STR(EDIT_CMD_DISABLE),
                          EDIT_CMD_STR(EDIT_CMD_ASSIGN),
-                         EDIT_CMD_STR(EDIT_CMD_INIT),
-                         optarg);
+                         EDIT_CMD_STR(EDIT_CMD_INIT));
            if (cmd_mode != code)
                command_mode_count++;
            cmd_mode = code;

-- 
        Viktor.

Reply via email to