2011-08-05 Ramon Novoa <rnovoa@artica.es>

* lib/PandoraFMS/Core.pm: Changed the return value of 
	  get_first_policy_queue.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4677 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
ramonn 2011-08-05 10:23:22 +00:00
parent b9fbb3eda0
commit aeb4e8edfc
2 changed files with 19 additions and 16 deletions

View File

@ -1,3 +1,8 @@
2011-08-05 Ramon Novoa <rnovoa@artica.es>
* lib/PandoraFMS/Core.pm: Changed the return value of
get_first_policy_queue.
2011-08-05 Koichiro KIKUCHI <koichiro@rworks.jp>
* pandora_server.redhat.spec: Updated dependecies. Removed perl-XML-SAX

View File

@ -2228,23 +2228,21 @@ sub pandora_process_policy_queue ($) {
while(1) {
my $operation = enterprise_hook('get_first_policy_queue', [$dbh]);
$operation = @{$operation}[0];
if(defined($operation)) {
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'}]);
}
elsif($operation->{'operation'} eq 'delete') {
if($operation->{'id_agent'} == 0) {
enterprise_hook('pandora_purge_policy_agents', [$dbh, $pa_config, $operation->{'id_policy'}]);
}
else {
enterprise_hook('pandora_delete_agent_from_policy', [$dbh, $pa_config, $operation->{'id_policy'}, $operation->{'id_agent'}]);
}
}
enterprise_hook('pandora_finish_queue_operation', [$dbh, $operation->{'id'}]);
next unless (defined ($operation) && $operation ne '');
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'}]);
}
elsif($operation->{'operation'} eq 'delete') {
if($operation->{'id_agent'} == 0) {
enterprise_hook('pandora_purge_policy_agents', [$dbh, $pa_config, $operation->{'id_policy'}]);
}
else {
enterprise_hook('pandora_delete_agent_from_policy', [$dbh, $pa_config, $operation->{'id_policy'}, $operation->{'id_agent'}]);
}
}
enterprise_hook('pandora_finish_queue_operation', [$dbh, $operation->{'id'}]);
# Check the queue each 5 seconds
sleep (5);