#9167 Fixed macros

This commit is contained in:
Daniel Maya 2022-09-12 13:54:23 +02:00
parent 06be85e044
commit 193ef3171c

View File

@ -180,8 +180,15 @@ sub data_consumer ($$) {
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'});