diff --git a/pandora_console/extras/mr/52.sql b/pandora_console/extras/mr/52.sql new file mode 100644 index 0000000000..81f1436632 --- /dev/null +++ b/pandora_console/extras/mr/52.sql @@ -0,0 +1,5 @@ +START TRANSACTION; +ALTER TABLE `tpolicy_queue` MODIFY COLUMN `progress` int(10) NOT NULL default '0'; + + +COMMIT; \ No newline at end of file diff --git a/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql b/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql index 20d5ba6324..6f3596cfa3 100644 --- a/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql +++ b/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql @@ -578,7 +578,7 @@ CREATE TABLE IF NOT EXISTS `tpolicy_queue` ( `id_policy` int(10) unsigned NOT NULL default '0', `id_agent` int(10) unsigned NOT NULL default '0', `operation` varchar(15) default '', - `progress` int(10) unsigned NOT NULL default '0', + `progress` int(10) NOT NULL default '0', `end_utimestamp` int(10) unsigned NOT NULL default 0, `priority` int(10) unsigned NOT NULL default '0', PRIMARY KEY (`id`) diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql index 68861c50eb..62cb177d3e 100644 --- a/pandora_console/pandoradb.sql +++ b/pandora_console/pandoradb.sql @@ -2951,7 +2951,7 @@ CREATE TABLE IF NOT EXISTS `tpolicy_queue` ( `id_policy` int(10) unsigned NOT NULL default '0', `id_agent` int(10) unsigned NOT NULL default '0', `operation` varchar(15) default '', - `progress` int(10) unsigned NOT NULL default '0', + `progress` int(10) NOT NULL default '0', `end_utimestamp` int(10) unsigned NOT NULL default 0, `priority` int(10) unsigned NOT NULL default '0', PRIMARY KEY (`id`) diff --git a/pandora_server/lib/PandoraFMS/Core.pm b/pandora_server/lib/PandoraFMS/Core.pm index 1f21390b0f..9058d83e96 100644 --- a/pandora_server/lib/PandoraFMS/Core.pm +++ b/pandora_server/lib/PandoraFMS/Core.pm @@ -5540,7 +5540,24 @@ sub pandora_process_policy_queue ($) { } if($operation->{'operation'} eq 'apply' || $operation->{'operation'} eq 'apply_db') { - enterprise_hook('pandora_apply_policy', [$dbh, $pa_config, $operation->{'id_policy'}, $operation->{'id_agent'}, $operation->{'id'}, $operation->{'operation'}]); + my $policy_applied = enterprise_hook( + 'pandora_apply_policy', + [ + $dbh, + $pa_config, + $operation->{'id_policy'}, + $operation->{'id_agent'}, + $operation->{'id'}, + $operation->{'operation'} + ] + ); + + if($policy_applied == 0) { + sleep($pa_config->{'server_threshold'}); + # Skip. + next; + } + } elsif($operation->{'operation'} eq 'delete') { if($operation->{'id_agent'} == 0) {