Merge branch 'ent-9167-cepsa-error-modulo-plugin-server-masivas-y-actualizar-modulo' into 'develop'

Ent 9167 cepsa error modulo plugin server masivas y actualizar modulo

See merge request artica/pandorafms!5101
This commit is contained in:
Daniel Rodriguez 2022-09-26 08:41:26 +00:00
commit e5cd925925
1 changed files with 14 additions and 7 deletions

View File

@ -160,28 +160,35 @@ sub data_consumer ($$) {
if($timeout <= 0) {
$timeout = 15;
}
# Build command to execute
my $command = $plugin->{'execute'};
if (!defined($plugin->{'parameters'})){
$plugin->{'parameters'} = "";
}
my $parameters = $plugin->{'parameters'};
my %plugin_macros_for_alert_processing;
if (!defined($module->{'macros'})){
$module->{'macros'} = "";
}
# Plugin macros
eval {
if ($module->{'macros'} ne '') {
logger ($pa_config, "Decoding json macros from # $module_id plugin command '$command'", 10);
my $macros = p_decode_json($pa_config, encode_utf8($module->{'macros'}));
my %macros = %{$macros};
if(ref($macros) eq "HASH") {
my %macros;
if(ref($macros) eq "ARRAY") {
my $count = 1;
%macros = map { $count++ => $_ } @$macros;
} else {
%macros = %{$macros};
}
if(ref(\%macros) eq "HASH") {
foreach my $macro_id (keys(%macros))
{
my $macro_field = safe_output($macros{$macro_id}{'macro'});