From ed5a909d012a93d8d89586618ff247143ff43609 Mon Sep 17 00:00:00 2001 From: zarzuelo Date: Thu, 12 May 2011 11:47:21 +0000 Subject: [PATCH] 2011-05-12 Sergio Martin * util/pandora_manage.pl: Added check of the returning of add operation to queue git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4344 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_server/ChangeLog | 5 +++++ pandora_server/util/pandora_manage.pl | 9 ++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/pandora_server/ChangeLog b/pandora_server/ChangeLog index ea6b8951ea..4d0648f19f 100644 --- a/pandora_server/ChangeLog +++ b/pandora_server/ChangeLog @@ -1,3 +1,8 @@ +2011-05-12 Sergio Martin + + * util/pandora_manage.pl: Added check of the returning of add + operation to queue + 2011-05-12 Sergio Martin * lib/PandoraFMS/DB.pm: Added a function to give the address of diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index 812f8ce3f0..07cd2871bc 100755 --- a/pandora_server/util/pandora_manage.pl +++ b/pandora_server/util/pandora_manage.pl @@ -1227,7 +1227,14 @@ sub pandora_manage_main ($$$) { my $policy_id = enterprise_hook('get_policy_id',[$dbh, $policy_name]); exist_check($policy_id,'policy',$policy_name); - enterprise_hook('pandora_add_policy_queue', [$dbh, $conf, $policy_id, 'apply']); + my $ret = enterprise_hook('pandora_add_policy_queue', [$dbh, $conf, $policy_id, 'apply']); + + if($ret == -1) { + print "[ERROR] Operation 'apply' cannot be added to policy '$policy_name' because is duplicated in queue or incompatible with others operations\n\n"; + exit; + } + + print "[INFO] Added operation 'apply' to policy '$policy_name'\n\n"; } elsif ($param eq '--disable_policy_alerts') { param_check($ltotal, 1);