This commit is contained in:
Quentin Garnier 2014-12-08 20:15:21 +01:00
parent 0d1e0af937
commit 06a94b6d66
5 changed files with 10 additions and 9 deletions

View File

@ -121,7 +121,7 @@ sub init {
} elsif (defined($self->{dynmode_name}) && $self->{dynmode_name} ne '') {
centreon::plugins::misc::mymodule_load(output => $self->{output}, module => $self->{dynmode_name},
error_msg => "Cannot load module --dyn-mode.");
$self->{mode} = $self->{dynmode_name}->new(options => $self->{options}, output => $self->{output}, mode => $self->{mode_name});
$self->{mode} = $self->{dynmode_name}->new(options => $self->{options}, output => $self->{output}, mode => $self->{dynmode_name});
} else {
$self->{output}->add_option_msg(short_msg => "Need to specify '--mode' or '--dyn-mode' option.");
$self->{output}->option_exit();

View File

@ -100,7 +100,7 @@ sub init {
} elsif (defined($self->{dynmode_name}) && $self->{dynmode_name} ne '') {
centreon::plugins::misc::mymodule_load(output => $self->{output}, module => $self->{dynmode_name},
error_msg => "Cannot load module --dyn-mode.");
$self->{mode} = $self->{dynmode_name}->new(options => $self->{options}, output => $self->{output}, mode => $self->{mode_name});
$self->{mode} = $self->{dynmode_name}->new(options => $self->{options}, output => $self->{output}, mode => $self->{dynmode_name});
} else {
$self->{output}->add_option_msg(short_msg => "Need to specify '--mode' or '--dyn-mode' option.");
$self->{output}->option_exit();

View File

@ -52,7 +52,7 @@ sub new {
$self->{options}->add_options(
arguments => {
'mode:s' => { name => 'mode' },
'mode:s' => { name => 'mode_name' },
'dyn-mode:s' => { name => 'dynmode_name' },
'list-mode' => { name => 'list_mode' },
'mode-version:s' => { name => 'mode_version' },
@ -63,9 +63,10 @@ sub new {
$self->{default} = undef;
$self->{options}->parse_options();
$self->{mode_name} = $self->{options}->get_option(argument => 'mode');
$self->{list_mode} = $self->{options}->get_option(argument => 'list_mode');
$self->{mode_version} = $self->{options}->get_option(argument => 'mode_version');
$self->{option_results} = $self->{options}->get_options();
foreach (keys %{$self->{option_results}}) {
$self->{$_} = $self->{option_results}->{$_};
}
$self->{options}->clean();
$self->{options}->add_help(package => $options{package}, sections => 'PLUGIN DESCRIPTION');
@ -105,7 +106,7 @@ sub init {
} elsif (defined($self->{dynmode_name}) && $self->{dynmode_name} ne '') {
centreon::plugins::misc::mymodule_load(output => $self->{output}, module => $self->{dynmode_name},
error_msg => "Cannot load module --dyn-mode.");
$self->{mode} = $self->{dynmode_name}->new(options => $self->{options}, output => $self->{output}, mode => $self->{mode_name});
$self->{mode} = $self->{dynmode_name}->new(options => $self->{options}, output => $self->{output}, mode => $self->{dynmode_name});
} else {
$self->{output}->add_option_msg(short_msg => "Need to specify '--mode' or '--dyn-mode' option.");
$self->{output}->option_exit();

View File

@ -122,7 +122,7 @@ sub init {
} elsif (defined($self->{dynmode_name}) && $self->{dynmode_name} ne '') {
centreon::plugins::misc::mymodule_load(output => $self->{output}, module => $self->{dynmode_name},
error_msg => "Cannot load module --dyn-mode.");
$self->{mode} = $self->{dynmode_name}->new(options => $self->{options}, output => $self->{output}, mode => $self->{mode_name});
$self->{mode} = $self->{dynmode_name}->new(options => $self->{options}, output => $self->{output}, mode => $self->{dynmode_name});
} else {
$self->{output}->add_option_msg(short_msg => "Need to specify '--mode' or '--dyn-mode' option.");
$self->{output}->option_exit();

View File

@ -105,7 +105,7 @@ sub init {
} elsif (defined($self->{dynmode_name}) && $self->{dynmode_name} ne '') {
centreon::plugins::misc::mymodule_load(output => $self->{output}, module => $self->{dynmode_name},
error_msg => "Cannot load module --dyn-mode.");
$self->{mode} = $self->{dynmode_name}->new(options => $self->{options}, output => $self->{output}, mode => $self->{mode_name});
$self->{mode} = $self->{dynmode_name}->new(options => $self->{options}, output => $self->{output}, mode => $self->{dynmode_name});
} else {
$self->{output}->add_option_msg(short_msg => "Need to specify '--mode' or '--dyn-mode' option.");
$self->{output}->option_exit();