[Rt-commit] rt branch, 4.4/fix-ldapimporter-debug-logging, created. rt-4.4.1-215-g154d659

Dustin Collins strega at bestpractical.com
Sat Dec 31 20:20:17 EST 2016


The branch, 4.4/fix-ldapimporter-debug-logging has been created
        at  154d6596e8a4061ace12e3cb889b89d3273841fd (commit)

- Log -----------------------------------------------------------------
commit 154d6596e8a4061ace12e3cb889b89d3273841fd
Author: Dustin Collins <strega at bestpractical.com>
Date:   Sat Dec 31 19:41:51 2016 -0500

    Fix rt-ldapimporter logging output
    
    --debug is replaced with --verbose becaue the logging level
    changes were being set to late.
    This is related to 9d354baa1a434c619248605d860676e48b17737d
    
    Fixes: T#177561

diff --git a/sbin/rt-ldapimport.in b/sbin/rt-ldapimport.in
index 449e7f0..2ba28d0 100644
--- a/sbin/rt-ldapimport.in
+++ b/sbin/rt-ldapimport.in
@@ -68,11 +68,6 @@ BEGIN { # BEGIN RT CMD BOILERPLATE
 
 }
 
-BEGIN {
-    use RT;
-    RT::LoadConfig();
-    RT::Init();
-};
 
 eval { require RT::LDAPImport; 1; } or do {
     print "Unable to run rt-ldapimport without dependencies.\n";
@@ -85,17 +80,16 @@ my %OPT = (
     users  => 1,
     groups => 1,
 );
-use Getopt::Long;
-GetOptions(
+use RT::Interface::CLI qw(Init);
+Init(
     \%OPT,
-    'debug', 'help',
-    'import', 'users!', 'groups!',
-);
+    'help',
+    'import', 'users!', 'groups!');
 if ($OPT{help}) {
    print <<USAGE;
-$0: [--debug] [--import] [--help]
+$0: [--import] [--help]
      --help           This usage statement.
-     --debug          Enable debugging.
+     --verbose        Show additional logging.
      --import         Do the import.
      --no-users       Skip users.
      --no-groups      Skip groups.
@@ -105,12 +99,6 @@ USAGE
 
 my $importer = RT::LDAPImport->new;
 
-if( $OPT{debug} ) {
-    RT->Config->Set( LogToSTDERR => 'debug' );
-} else {
-    RT->Config->Set( LogToSTDERR => undef );
-}
-
 if ($OPT{import}) {
     if ($OPT{users}) {
         print "Starting import\n";
@@ -125,7 +113,7 @@ if ($OPT{import}) {
     print <<TESTING;
 Running test import, no data will be changed
 Rerun command with --import to perform the import
-Rerun command with --debug for more information
+Rerun command with --verbose for more information
 TESTING
     $importer->import_users if $OPT{users};
     if ($OPT{groups}) {

-----------------------------------------------------------------------


More information about the rt-commit mailing list