Merge pull request #30 from ClusterLabs/string_bugs
* Fixed a bug where Words->load_agent_strings() wouldn't process stri…
This commit is contained in:
commit
66e0fb4490
@ -467,15 +467,16 @@ sub send_alerts
|
|||||||
{
|
{
|
||||||
# The user wants it.
|
# The user wants it.
|
||||||
my $message = $anvil->Words->parse_banged_string({
|
my $message = $anvil->Words->parse_banged_string({
|
||||||
|
debug => $debug,
|
||||||
language => $recipient_language,
|
language => $recipient_language,
|
||||||
key_string => $alert_message,
|
key_string => $alert_message,
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
# A lot of multi-line strings start with an opening new line. This removes that.
|
# A lot of multi-line strings start with an opening new line. This removes that.
|
||||||
$message =~ s/^\n//;
|
$message =~ s/^\n//;
|
||||||
$message =~ s/\n$//s;
|
$message =~ s/\n$//s;
|
||||||
|
|
||||||
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { message => $message }});
|
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { message => $message }});
|
||||||
|
|
||||||
if ($alert_title)
|
if ($alert_title)
|
||||||
{
|
{
|
||||||
my $title = "[ ".$alert_set_by." ] ".$anvil->Words->parse_banged_string({
|
my $title = "[ ".$alert_set_by." ] ".$anvil->Words->parse_banged_string({
|
||||||
|
@ -343,16 +343,19 @@ sub load_agent_strings
|
|||||||
foreach my $agent_name (sort {$a cmp $b} keys %{$anvil->data->{scancore}{agent}})
|
foreach my $agent_name (sort {$a cmp $b} keys %{$anvil->data->{scancore}{agent}})
|
||||||
{
|
{
|
||||||
my $agent_words = $anvil->data->{scancore}{agent}{$agent_name}.".xml";
|
my $agent_words = $anvil->data->{scancore}{agent}{$agent_name}.".xml";
|
||||||
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { agent_words => $agent_words }});
|
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { agent_words => $agent_words }});
|
||||||
|
|
||||||
if ((-e $agent_words) && (-r $agent_words))
|
if ((-e $agent_words) && (-r $agent_words))
|
||||||
{
|
{
|
||||||
# Read the words file.
|
# Read the words file.
|
||||||
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 2, key => "log_0251", variables => {
|
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => $debug, key => "log_0251", variables => {
|
||||||
agent_name => $agent_name,
|
agent_name => $agent_name,
|
||||||
file => $agent_words,
|
file => $agent_words,
|
||||||
}});
|
}});
|
||||||
$anvil->Words->read({file => $agent_words});
|
$anvil->Words->read({
|
||||||
|
debug => $debug,
|
||||||
|
file => $agent_words,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -447,6 +450,12 @@ sub parse_banged_string
|
|||||||
$new_string =~ s/\n$//;
|
$new_string =~ s/\n$//;
|
||||||
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { new_string => $new_string }});
|
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { new_string => $new_string }});
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
# If a string doesn't have a new-line, then copy the key string directly.
|
||||||
|
$new_string = $key_string;
|
||||||
|
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { new_string => $new_string }});
|
||||||
|
}
|
||||||
|
|
||||||
# There might be multiple keys, split by newlines.
|
# There might be multiple keys, split by newlines.
|
||||||
foreach my $message (split/\n/, $new_string)
|
foreach my $message (split/\n/, $new_string)
|
||||||
|
Loading…
Reference in New Issue
Block a user