[Bps-public-commit] RT-Extension-LDAPImport branch, master, updated. 0.32_04-4-gd2f1436
Thomas Sibley
trs at bestpractical.com
Thu May 24 13:00:53 EDT 2012
The branch, master has been updated
via d2f1436c4ab96dbd24b919522a0d3c5393ad0135 (commit)
from a49b3801d02ec59d7f970b10a76dbf6fa203e043 (commit)
Summary of changes:
bin/rtldapimport.in | 39 +++++++++++++++++++++++++++------------
1 file changed, 27 insertions(+), 12 deletions(-)
- Log -----------------------------------------------------------------
commit d2f1436c4ab96dbd24b919522a0d3c5393ad0135
Author: Thomas Sibley <trs at bestpractical.com>
Date: Thu May 24 10:56:36 2012 -0400
Support skipping users or groups during import
You may want to update just one or the other manually while between
cronjobs.
diff --git a/bin/rtldapimport.in b/bin/rtldapimport.in
index efc6c58..3222d7d 100755
--- a/bin/rtldapimport.in
+++ b/bin/rtldapimport.in
@@ -22,27 +22,40 @@ RT::Init;
use RT::Extension::LDAPImport;
-my ($debug,$import,$help);
+my %OPT = (
+ users => 1,
+ groups => 1,
+);
use Getopt::Long;
-GetOptions ( "debug" => \$debug, "help" => \$help, "import" => \$import );
-if ($help) {
+GetOptions(
+ \%OPT,
+ 'debug', 'help',
+ 'import', 'users!', 'groups!',
+);
+if ($OPT{help}) {
print <<USAGE;
$0: [--debug] [--import] [--help]
--help This usage statement.
--debug Enable debugging.
--import Do the import.
+ --no-users Skip users.
+ --no-groups Skip groups.
USAGE
exit 0;
}
my $importer = RT::Extension::LDAPImport->new;
-$importer->screendebug(1) if $debug;
+$importer->screendebug(1) if $OPT{debug};
-if ($import) {
- print "Starting import\n";
- $importer->import_users(import => 1);
- print "Starting group import\n";
- $importer->import_groups(import => 1);
+if ($OPT{import}) {
+ if ($OPT{users}) {
+ print "Starting import\n";
+ $importer->import_users(import => 1);
+ }
+ if ($OPT{groups}) {
+ print "Starting group import\n";
+ $importer->import_groups(import => 1);
+ }
print "Finished import\n";
} else {
print <<TESTING;
@@ -50,8 +63,10 @@ Running test import, no data will be changed
Rerun command with --import to perform the import
Rerun command with --debug for more information
TESTING
- $importer->import_users;
- print "Testing group import\n";
- $importer->import_groups();
+ $importer->import_users if $OPT{users};
+ if ($OPT{groups}) {
+ print "Testing group import\n";
+ $importer->import_groups();
+ }
print "Finished test\n";
}
-----------------------------------------------------------------------
More information about the Bps-public-commit
mailing list