From 404460768fe3e7cbfa15f98cf19772416c9b71d4 Mon Sep 17 00:00:00 2001 From: Mykola Malkov Date: Wed, 7 Jun 2023 16:58:56 +0300 Subject: [PATCH] MT#57461 Add --debug option Print known exceptions only if --debug option is used. No need to flood output with useless messages. Change-Id: I4460a370d44dc0f95beb654efc493270f11103d3 --- helper/compare_dbs.pl | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/helper/compare_dbs.pl b/helper/compare_dbs.pl index 4d35f1c..8976b84 100755 --- a/helper/compare_dbs.pl +++ b/helper/compare_dbs.pl @@ -56,6 +56,7 @@ my $argv = { schema_file => '', schema_name => '', user_db1 => '', + debug => 0, }; get_options(); @@ -223,6 +224,7 @@ sub get_options { 'pass-db1=s' => \$argv->{'pass_db1'}, 'port-db1=s' => \$argv->{'port_db1'}, 'help|h' => sub{ print_usage(); exit(0); }, + 'debug' => \$argv->{'debug'}, ); } @@ -242,6 +244,7 @@ Options: --pass-db1= Password of the 1st schema --port-db1= Port of the 1st schema -h, --help Print this message and exit. + --debug Print exception message for known exceptions. __USAGE__ ; print $usage; @@ -256,7 +259,9 @@ sub is_exception { foreach my $exception (@{$exceptions}) { # 'views/ldap/ldap_entries/view_definition' if ( lc("$type/$schema/$element/$attr") =~ $exception ) { - print {*STDERR} "Exception found: $exception\n"; + if ( $argv->{'debug'} ) { + print {*STDERR} "Exception found: $exception\n"; + } return 1; } }