From d0032110d14404582e7f359467bff589e00a81b6 Mon Sep 17 00:00:00 2001 From: Simon Bomm Date: Mon, 20 Oct 2014 11:32:56 +0200 Subject: [PATCH 1/3] Add check option to ensure that --scenario option is set --- centreon-plugins/apps/selenium/mode/scenario.pm | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/centreon-plugins/apps/selenium/mode/scenario.pm b/centreon-plugins/apps/selenium/mode/scenario.pm index d07901f77..1b749d21d 100644 --- a/centreon-plugins/apps/selenium/mode/scenario.pm +++ b/centreon-plugins/apps/selenium/mode/scenario.pm @@ -106,6 +106,11 @@ sub check_options { $self->{option_results}->{timeout} > 0) { alarm($self->{option_results}->{timeout}); } + if (!defined($self->{option_results}->{scenario})) + $self->{output}->add_option_msg(short_msg => "Please specify a scenario name" . $self->{option_results}->{scenario} . "'."); + $self->{output}->option_exit(); + } + } sub run { @@ -113,7 +118,7 @@ sub run { my $p = XML::Parser->new(NoLWP => 1); my $filename = $self->{option_results}->{directory} . '/' . $self->{option_results}->{scenario} . '.html'; - my $xp = XML::XPath->new(parser => $p, filename => $filename); + #my $xp = XML::XPath->new(parser => $p, filename => $filename); my $baseurlNode = $xp->find('/html/head/link[@rel="selenium.base"]'); my $baseurl = $baseurlNode->shift->getAttribute('href'); From 93fd83bebe4002137926c2213858d300e990fa5f Mon Sep 17 00:00:00 2001 From: Simon Bomm Date: Mon, 20 Oct 2014 11:41:30 +0200 Subject: [PATCH 2/3] correct { error --- centreon-plugins/apps/selenium/mode/scenario.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/centreon-plugins/apps/selenium/mode/scenario.pm b/centreon-plugins/apps/selenium/mode/scenario.pm index 1b749d21d..cc4566692 100644 --- a/centreon-plugins/apps/selenium/mode/scenario.pm +++ b/centreon-plugins/apps/selenium/mode/scenario.pm @@ -106,7 +106,7 @@ sub check_options { $self->{option_results}->{timeout} > 0) { alarm($self->{option_results}->{timeout}); } - if (!defined($self->{option_results}->{scenario})) + if (!defined($self->{option_results}->{scenario})) { $self->{output}->add_option_msg(short_msg => "Please specify a scenario name" . $self->{option_results}->{scenario} . "'."); $self->{output}->option_exit(); } From cf10287f3c0cc5e5ca4c95a3cf004638d30e2cdf Mon Sep 17 00:00:00 2001 From: Simon Bomm Date: Mon, 20 Oct 2014 11:46:21 +0200 Subject: [PATCH 3/3] uncomment line, vim mystery :/ --- centreon-plugins/apps/selenium/mode/scenario.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/centreon-plugins/apps/selenium/mode/scenario.pm b/centreon-plugins/apps/selenium/mode/scenario.pm index cc4566692..c5118097a 100644 --- a/centreon-plugins/apps/selenium/mode/scenario.pm +++ b/centreon-plugins/apps/selenium/mode/scenario.pm @@ -107,7 +107,7 @@ sub check_options { alarm($self->{option_results}->{timeout}); } if (!defined($self->{option_results}->{scenario})) { - $self->{output}->add_option_msg(short_msg => "Please specify a scenario name" . $self->{option_results}->{scenario} . "'."); + $self->{output}->add_option_msg(short_msg => "Please specify a scenario name" . $self->{option_results}->{scenario} . "."); $self->{output}->option_exit(); } @@ -118,7 +118,7 @@ sub run { my $p = XML::Parser->new(NoLWP => 1); my $filename = $self->{option_results}->{directory} . '/' . $self->{option_results}->{scenario} . '.html'; - #my $xp = XML::XPath->new(parser => $p, filename => $filename); + my $xp = XML::XPath->new(parser => $p, filename => $filename); my $baseurlNode = $xp->find('/html/head/link[@rel="selenium.base"]'); my $baseurl = $baseurlNode->shift->getAttribute('href');