OneTicketPerRequestor: Handle more YAML errors.

This avoids dying in cases where the YAML file is empty or malformed.
This commit is contained in:
Brett Smith 2018-04-26 09:46:11 -04:00
parent 325c5ceaf6
commit 727d9d5659

View file

@ -18,10 +18,8 @@ my $plugin_self = RT::Plugin->new(name => "RT-Extension-Conservancy");
foreach my $confdir ($plugin_self->Path("etc"), $RT::LocalEtcPath, $RT::EtcPath) {
next unless (defined($confdir) && $confdir);
my $conf_path = "$confdir/OneTicketPerRequestor.yml";
if (-r $conf_path) {
%QUEUES = %{YAML::Tiny->read($conf_path)->[0]};
eval { %QUEUES = %{YAML::Tiny->read($conf_path)->[0]} };
last if (%QUEUES);
}
}
# Compile the user's configuration into arguments for RT::Tickets->OrderBy.