From f39987002d89534353d63aab58e09ef91096dc64 Mon Sep 17 00:00:00 2001 From: lissav Date: Fri, 5 Nov 2010 11:14:05 +0000 Subject: [PATCH] added verbose mode so users can see the error that we don't want displayed during install git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@8056 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/sbin/runsqlcmd | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/xCAT-server/sbin/runsqlcmd b/xCAT-server/sbin/runsqlcmd index a86a06495..502ef46ff 100755 --- a/xCAT-server/sbin/runsqlcmd +++ b/xCAT-server/sbin/runsqlcmd @@ -37,7 +37,7 @@ use strict; $::progname = "runsqlcmd"; Getopt::Long::Configure("bundling"); $Getopt::Long::ignorecase = 0; -my ($directory, $help, $version, $filelist); +my ($directory, $help, $version,$verbose, $filelist); # parse the options if ( @@ -46,6 +46,7 @@ if ( 'f|files=s' => \$filelist, 'h|help' => \$help, 'v|version' => \$version, + 'V|verbose' => \$verbose, ) ) { @@ -139,14 +140,18 @@ if (@sqlfilelist) { # if anything to do if ($xcatcfg =~ /^SQLite:/) { # not supported but will leave routine in case we change our mind - xCAT::MsgUtils->message("SE", "The runsqlcmd does not support the SQLite database."); + if ($verbose) { + xCAT::MsgUtils->message("SE", "The runsqlcmd does not support the SQLite database."); + } #&runsqlitecmd($file,$xcatcfg); exit 1; } } } else { - xCAT::MsgUtils->message("SE", "The runsqlcmd has no files to process in $directory ."); + if ($verbose) { + xCAT::MsgUtils->message("SI", "The runsqlcmd has no files to process in $directory ."); + } } if ($tempfile) { my $cmd = "rm $tempfile"; @@ -181,7 +186,7 @@ sub usage "Usage:\nRuns the sql commands in files located in /opt/xcat/lib/perl/xCAT_schema by default, or the directory input with -d, or the list of files input with the -f flag, or the command input on the command line. Supports DB2,PostgreSQL,MySQL." ); my $msg = - "runsqlcmd <-h|--help>\n <-v|--version>\n <-d|--dir>\n <-f|--files> \n "; + "runsqlcmd <-h|--help>\n <-v|--version>\n <-V|--verbose>\n <-d|--dir>\n <-f|--files> \n "; xCAT::MsgUtils->message('I', "$msg"); }