diff --git a/pandora_agents/unix/ChangeLog b/pandora_agents/unix/ChangeLog index 1ba85c5711..d2b0ff9357 100644 --- a/pandora_agents/unix/ChangeLog +++ b/pandora_agents/unix/ChangeLog @@ -1,3 +1,8 @@ +2011-12-14 Ramon Novoa + + * pandora_agent: Do not display a warning if the output of a + pre-condition is not numeric. + 2011-12-07 KIKUCHI Koichiro * pandora_agent_installer: Removed duplicated lines and spaces to diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent index fd1213bb53..bb27ff9c9a 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -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; }