2011-12-14 Ramon Novoa <rnovoa@artica.es>

* pandora_agent: Do not display a warning if the output of a
	  pre-condition is not numeric.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5258 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
ramonn 2011-12-14 11:43:24 +00:00
parent 7f46470d32
commit a8b8f6cb83
2 changed files with 22 additions and 15 deletions

View File

@ -1,3 +1,8 @@
2011-12-14 Ramon Novoa <rnovoa@artica.es>
* pandora_agent: Do not display a warning if the output of a
pre-condition is not numeric.
2011-12-07 KIKUCHI Koichiro <koichiro@rworks.jp>
* pandora_agent_installer: Removed duplicated lines and spaces to

View File

@ -1332,7 +1332,6 @@ sub module_freepercentmemory ($) {
################################################################################
sub evaluate_module_preconditions ($) {
my ($module) = @_;
my $exe = 1;
# Evaluate preconditions
if ($module->{'precon'}){
@ -1340,21 +1339,24 @@ sub evaluate_module_preconditions ($) {
foreach my $precondition (@{$module->{'precondition'}}) {
my $data = `$precondition->{'command'} 2> $DevNull`;
if (($precondition->{'operator'} eq '>' && $data > $precondition->{'value_1'}) ||
($precondition->{'operator'} eq '<' && $data < $precondition->{'value_1'}) ||
($precondition->{'operator'} eq '=' && $data == $precondition->{'value_1'}) ||
($precondition->{'operator'} eq '!=' && $data != $precondition->{'value_1'}) ||
($precondition->{'operator'} eq '=~' && $data =~ /$precondition->{'value_1'}/) ||
($precondition->{'operator'} eq '()' && $data > $precondition->{'value_1'} && $data < $precondition->{'value_2'})) {
$exe = 1;
} else {
$exe = 0;
return $exe;
}
{
# Do not display a warning if the output of the command is not numeric
no warnings;
if (($precondition->{'operator'} eq '>' && $data > $precondition->{'value_1'}) ||
($precondition->{'operator'} eq '<' && $data < $precondition->{'value_1'}) ||
($precondition->{'operator'} eq '=' && $data == $precondition->{'value_1'}) ||
($precondition->{'operator'} eq '!=' && $data != $precondition->{'value_1'}) ||
($precondition->{'operator'} eq '=~' && $data =~ /$precondition->{'value_1'}/) ||
($precondition->{'operator'} eq '()' && $data > $precondition->{'value_1'} && $data < $precondition->{'value_2'})) {
} else {
return 0;
}
};
}
}
return $exe;
}
return 1;
}