Commit 22a8be53 authored by Jelte Jansen's avatar Jelte Jansen
Browse files

[963] add --quiet mode to b10-dbutil

parent 5e70d900
......@@ -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\&.
......
......@@ -45,12 +45,14 @@
<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>
......@@ -161,6 +163,17 @@
</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>
......
......@@ -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
......
......@@ -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 << .
......
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