]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[963] add --quiet mode to b10-dbutil
authorJelte Jansen <jelte@isc.org>
Fri, 23 Mar 2012 15:46:17 +0000 (16:46 +0100)
committerJelte Jansen <jelte@isc.org>
Fri, 23 Mar 2012 15:46:17 +0000 (16:46 +0100)
src/bin/dbutil/b10-dbutil.8
src/bin/dbutil/b10-dbutil.xml
src/bin/dbutil/dbutil.py.in
src/bin/dbutil/tests/dbutil_test.sh.in

index d706ee5c640c934f58c6d0fee827232395ede682..ff7a2e5cfaf873ec6a8c8075d4b04ff2ebc051a4 100644 (file)
@@ -31,9 +31,9 @@
 b10-dbutil \- Zone Database Maintenance Utility
 .SH "SYNOPSIS"
 .HP \w'\fBb10\-dbutil\ \-\-check\fR\ 'u
-\fBb10\-dbutil \-\-check\fR [\-\-verbose] [\fIdbfile\fR]
+\fBb10\-dbutil \-\-check\fR [\-\-verbose] [\-\-quiet] [\fIdbfile\fR]
 .HP \w'\fBb10\-dbutil\ \-\-upgrade\fR\ 'u
-\fBb10\-dbutil \-\-upgrade\fR [\-\-noconfirm] [\-\-verbose] [\fIdbfile\fR]
+\fBb10\-dbutil \-\-upgrade\fR [\-\-noconfirm] [\-\-verbose] [\-\-quiet] [\fIdbfile\fR]
 .SH "DESCRIPTION"
 .PP
 The
@@ -77,6 +77,11 @@ The upgrade function will upgrade a BIND 10 database \- no matter how old the sc
 Enable verbose mode\&. Each SQL command issued by the utility will be printed to stdout before it is executed\&.
 .RE
 .PP
+\fB\-\-quiet\fR
+.RS 4
+Enable quiet mode\&. No output is printed, except errors during command\-line argument parsing, or the user confirmation dialog\&.
+.RE
+.PP
 \fB\fIdbfile\fR\fR
 .RS 4
 Name of the database file to check of upgrade\&.
index 8178ac8451f631f36daf14c33089f065768eeeb3..d1ce2fcad8e097de5d7860745e2b1f2227fddbc5 100644 (file)
     <cmdsynopsis>
       <command>b10-dbutil --check</command>
         <arg>--verbose</arg>
+        <arg>--quiet</arg>
         <arg><replaceable choice='req'>dbfile</replaceable></arg>
     </cmdsynopsis>
     <cmdsynopsis>
       <command>b10-dbutil --upgrade</command>
         <arg>--noconfirm</arg>
         <arg>--verbose</arg>
+        <arg>--quiet</arg>
         <arg><replaceable choice='req'>dbfile</replaceable></arg>
     </cmdsynopsis>
   </refsynopsisdiv>
         </listitem>
       </varlistentry>
 
+      <varlistentry>
+        <term>
+         <option>--quiet</option>
+        </term>
+        <listitem>
+          <para>Enable quiet mode. No output is printed, except errors during
+            command-line argument parsing, or the user confirmation dialog.
+          </para>
+        </listitem>
+      </varlistentry>
+
       <varlistentry>
         <term>
         <option><replaceable choice='req'>dbfile</replaceable></option>
index de5c4bdc39d32ceb88ba32a19a8029d376e926d0..a5e12ad67dd9e03fa74b31380cc4d46a296d49fe 100755 (executable)
@@ -509,6 +509,9 @@ def parse_command():
     parser.add_option("-v", "--verbose", action="store_true",
                       dest="verbose", default=False,
                       help="Print SQL statements as they are executed")
+    parser.add_option("-q", "--quiet", action="store_true",
+                      dest="quiet", default=False,
+                      help="Don't print any info, warnings or errors")
     (options, args) = parser.parse_args()
 
     # Set the database file on which to operate
@@ -543,6 +546,11 @@ if __name__ == "__main__":
     if options.verbose:
         isc.log.init("b10-dbutil", "DEBUG", 99)
         logger = isc.log.Logger("dbutil")
+    elif options.quiet:
+        # We don't use FATAL, so setting the logger to use
+        # it should essentially make it silent.
+        isc.log.init("b10-dbutil", "FATAL")
+        logger = isc.log.Logger("dbutil")
 
     db = Database(args[0])
     exit_code = EXIT_SUCCESS
index 2a68777143deef21653791baa4baa1222453d27c..393d6e06f705c0d93bc4bd402876f9d7839d01ce 100755 (executable)
@@ -443,6 +443,12 @@ copy_file $testdata/old_v1.sqlite3 $tempfile
 passzero $?
 rm -f $tempfile $backupfile
 
+echo "13.3 quiet flag"
+copy_file $testdata/old_v1.sqlite3 $tempfile
+../run_dbutil.sh --check --quiet $tempfile 2>&1 | grep dbutil
+failzero $?
+rm -f $tempfile $backupfile
+
 echo "13.3 Interactive prompt - yes"
 copy_file $testdata/old_v1.sqlite3 $tempfile
 ../run_dbutil.sh --upgrade $tempfile << .