Fix db lock stopping policy apply
This commit is contained in:
parent
f162a8e6e1
commit
0bad3761a7
|
@ -0,0 +1,5 @@
|
|||
START TRANSACTION;
|
||||
ALTER TABLE `tpolicy_queue` MODIFY COLUMN `progress` int(10) NOT NULL default '0';
|
||||
|
||||
|
||||
COMMIT;
|
|
@ -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`)
|
||||
|
|
|
@ -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`)
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue