From e5b643275546c12b997e90b32488926eb17d13d0 Mon Sep 17 00:00:00 2001 From: Jason Crome Date: Tue, 14 May 2024 08:50:46 -0400 Subject: [PATCH] Make separate import config files optional For regular import jobs, RT admins may wish to keep these settings alongside the rest of their RT config instead of managing separate config files. --- bin/rt-extension-import-csv.in | 7 +------ lib/RT/Extension/Import/CSV.pm | 9 +++++---- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/bin/rt-extension-import-csv.in b/bin/rt-extension-import-csv.in index dab8f1c..0e465d4 100755 --- a/bin/rt-extension-import-csv.in +++ b/bin/rt-extension-import-csv.in @@ -25,11 +25,6 @@ if ( $opt{help} || !$file ) { exit; } -unless ( $opt{config} ) { - Pod::Usage::pod2usage( "Option config is required" ); - exit; -} - unless ( ( $opt{type} // '' ) =~ /^(?:user|ticket|transaction|article)$/ ) { Pod::Usage::pod2usage( "Invalid type provided, should be one of user/ticket/transaction/article" ); exit; @@ -213,7 +208,7 @@ delimted files. See L for configuration. Provides an explicit extra configuration file which is loaded before any other configuration files. This is useful to provide per-import settings. F should B contain settings for options with hashes -that may get merged with per-import settings. This option is required. +that may get merged with per-import settings. =item C<--type> I or C<-t> I diff --git a/lib/RT/Extension/Import/CSV.pm b/lib/RT/Extension/Import/CSV.pm index d8fc02a..71501af 100644 --- a/lib/RT/Extension/Import/CSV.pm +++ b/lib/RT/Extension/Import/CSV.pm @@ -1636,10 +1636,11 @@ in the callback. It expects no return value. =head1 RUNNING THE IMPORT WITH A NON-DEFAULT CONFIGURATION -You must explicitly pass a configuration file to the importer. Use the -C<--config> option to specify the path and filename to the -configuration file to use; C<--type> indicates the type of import to -run (article, ticket, transation, or article): +You can explicitly pass a configuration file to the importer. This is +often used in conjunction when specifying an import type other than +ticket. Use the C<--config> option to specify the path and filename +to the configuration file to use; C<--type> indicates the type of +import to run (article, ticket, transation, or article): rt-extension-csv-importer --config /path/to/config.pm --type user /path/to/user-data.csv rt-extension-csv-importer --config /path/to/config.pm --type ticket /path/to/ticket-data.csv