Fix #6024
This commit is contained in:
parent
51161790c6
commit
f0607ebe09
|
@ -56,6 +56,16 @@ sub new {
|
||||||
return $self;
|
return $self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub set_sanity {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
|
Getopt::Long::Configure('no_pass_through');
|
||||||
|
$SIG{__WARN__} = sub {
|
||||||
|
$self->{output}->add_option_msg(short_msg => $_[0]);
|
||||||
|
$self->{output}->option_exit(nolabel => 1);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
sub set_output {
|
sub set_output {
|
||||||
my ($self, %options) = @_;
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
|
|
|
@ -57,6 +57,7 @@ sub new {
|
||||||
'custommode:s' => { name => 'custommode_name' },
|
'custommode:s' => { name => 'custommode_name' },
|
||||||
'list-custommode' => { name => 'list_custommode' },
|
'list-custommode' => { name => 'list_custommode' },
|
||||||
'multiple' => { name => 'multiple' },
|
'multiple' => { name => 'multiple' },
|
||||||
|
'sanity-options' => { name => 'sanity_options' },
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
$self->{version} = '1.0';
|
$self->{version} = '1.0';
|
||||||
|
@ -98,6 +99,9 @@ sub init {
|
||||||
if (defined($self->{list_custommode})) {
|
if (defined($self->{list_custommode})) {
|
||||||
$self->list_custommode();
|
$self->list_custommode();
|
||||||
}
|
}
|
||||||
|
if (defined($self->{sanity_options})) {
|
||||||
|
$self->{options}->set_sanity();
|
||||||
|
}
|
||||||
|
|
||||||
# Output HELP
|
# Output HELP
|
||||||
$self->{options}->add_help(package => 'centreon::plugins::output', sections => 'OUTPUT OPTIONS');
|
$self->{options}->add_help(package => 'centreon::plugins::output', sections => 'OUTPUT OPTIONS');
|
||||||
|
@ -250,17 +254,25 @@ __END__
|
||||||
|
|
||||||
Choose a mode.
|
Choose a mode.
|
||||||
|
|
||||||
|
=item B<--dyn-mode>
|
||||||
|
|
||||||
|
Specify a mode with the path (separated by '::').
|
||||||
|
|
||||||
=item B<--list-mode>
|
=item B<--list-mode>
|
||||||
|
|
||||||
List available modes.
|
List available modes.
|
||||||
|
|
||||||
|
=item B<--mode-version>
|
||||||
|
|
||||||
|
Check minimal version of mode. If not, unknown error.
|
||||||
|
|
||||||
=item B<--version>
|
=item B<--version>
|
||||||
|
|
||||||
Display plugin version.
|
Display plugin version.
|
||||||
|
|
||||||
=item B<--dyn-mode>
|
=item B<--sanity-options>
|
||||||
|
|
||||||
Specify a mode with the path (separated by '::').
|
Check unknown options (for debug purpose).
|
||||||
|
|
||||||
=item B<--custommode>
|
=item B<--custommode>
|
||||||
|
|
||||||
|
|
|
@ -50,10 +50,11 @@ sub new {
|
||||||
|
|
||||||
$self->{options}->add_options(
|
$self->{options}->add_options(
|
||||||
arguments => {
|
arguments => {
|
||||||
'mode:s' => { name => 'mode' },
|
'mode:s' => { name => 'mode_name' },
|
||||||
'dyn-mode:s' => { name => 'dynmode_name' },
|
'dyn-mode:s' => { name => 'dynmode_name' },
|
||||||
'list-mode' => { name => 'list_mode' },
|
'list-mode' => { name => 'list_mode' },
|
||||||
'mode-version:s' => { name => 'mode_version' },
|
'mode-version:s' => { name => 'mode_version' },
|
||||||
|
'sanity-options' => { name => 'sanity_options' },
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
$self->{version} = '1.0';
|
$self->{version} = '1.0';
|
||||||
|
@ -61,9 +62,10 @@ sub new {
|
||||||
$self->{default} = undef;
|
$self->{default} = undef;
|
||||||
|
|
||||||
$self->{options}->parse_options();
|
$self->{options}->parse_options();
|
||||||
$self->{mode_name} = $self->{options}->get_option(argument => 'mode');
|
$self->{option_results} = $self->{options}->get_options();
|
||||||
$self->{list_mode} = $self->{options}->get_option(argument => 'list_mode');
|
foreach (keys %{$self->{option_results}}) {
|
||||||
$self->{mode_version} = $self->{options}->get_option(argument => 'mode_version');
|
$self->{$_} = $self->{option_results}->{$_};
|
||||||
|
}
|
||||||
$self->{options}->clean();
|
$self->{options}->clean();
|
||||||
|
|
||||||
$self->{options}->add_help(package => $options{package}, sections => 'PLUGIN DESCRIPTION');
|
$self->{options}->add_help(package => $options{package}, sections => 'PLUGIN DESCRIPTION');
|
||||||
|
@ -87,6 +89,9 @@ sub init {
|
||||||
if (defined($self->{list_mode})) {
|
if (defined($self->{list_mode})) {
|
||||||
$self->list_mode();
|
$self->list_mode();
|
||||||
}
|
}
|
||||||
|
if (defined($self->{sanity_options})) {
|
||||||
|
$self->{options}->set_sanity();
|
||||||
|
}
|
||||||
|
|
||||||
# Output HELP
|
# Output HELP
|
||||||
$self->{options}->add_help(package => 'centreon::plugins::output', sections => 'OUTPUT OPTIONS');
|
$self->{options}->add_help(package => 'centreon::plugins::output', sections => 'OUTPUT OPTIONS');
|
||||||
|
@ -210,6 +215,10 @@ Check minimal version of mode. If not, unknown error.
|
||||||
|
|
||||||
Display plugin version.
|
Display plugin version.
|
||||||
|
|
||||||
|
=item B<--sanity-options>
|
||||||
|
|
||||||
|
Check unknown options (for debug purpose).
|
||||||
|
|
||||||
=back
|
=back
|
||||||
|
|
||||||
=head1 DESCRIPTION
|
=head1 DESCRIPTION
|
||||||
|
|
|
@ -56,6 +56,7 @@ sub new {
|
||||||
'dyn-mode:s' => { name => 'dynmode_name' },
|
'dyn-mode:s' => { name => 'dynmode_name' },
|
||||||
'list-mode' => { name => 'list_mode' },
|
'list-mode' => { name => 'list_mode' },
|
||||||
'mode-version:s' => { name => 'mode_version' },
|
'mode-version:s' => { name => 'mode_version' },
|
||||||
|
'sanity-options' => { name => 'sanity_options' },
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
$self->{version} = '1.0';
|
$self->{version} = '1.0';
|
||||||
|
@ -90,6 +91,9 @@ sub init {
|
||||||
if (defined($self->{list_mode})) {
|
if (defined($self->{list_mode})) {
|
||||||
$self->list_mode();
|
$self->list_mode();
|
||||||
}
|
}
|
||||||
|
if (defined($self->{sanity_options})) {
|
||||||
|
$self->{options}->set_sanity();
|
||||||
|
}
|
||||||
|
|
||||||
# Output HELP
|
# Output HELP
|
||||||
$self->{options}->add_help(package => 'centreon::plugins::output', sections => 'OUTPUT OPTIONS');
|
$self->{options}->add_help(package => 'centreon::plugins::output', sections => 'OUTPUT OPTIONS');
|
||||||
|
@ -219,6 +223,10 @@ Check minimal version of mode. If not, unknown error.
|
||||||
|
|
||||||
Display plugin version.
|
Display plugin version.
|
||||||
|
|
||||||
|
=item B<--sanity-options>
|
||||||
|
|
||||||
|
Check unknown options (for debug purpose).
|
||||||
|
|
||||||
=back
|
=back
|
||||||
|
|
||||||
=head1 DESCRIPTION
|
=head1 DESCRIPTION
|
||||||
|
|
|
@ -58,6 +58,7 @@ sub new {
|
||||||
'sqlmode:s' => { name => 'sqlmode_name', default => 'dbi' },
|
'sqlmode:s' => { name => 'sqlmode_name', default => 'dbi' },
|
||||||
'list-sqlmode' => { name => 'list_sqlmode' },
|
'list-sqlmode' => { name => 'list_sqlmode' },
|
||||||
'multiple' => { name => 'multiple' },
|
'multiple' => { name => 'multiple' },
|
||||||
|
'sanity-options' => { name => 'sanity_options' },
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
$self->{version} = '1.0';
|
$self->{version} = '1.0';
|
||||||
|
@ -99,6 +100,9 @@ sub init {
|
||||||
if (defined($self->{list_sqlmode})) {
|
if (defined($self->{list_sqlmode})) {
|
||||||
$self->list_sqlmode();
|
$self->list_sqlmode();
|
||||||
}
|
}
|
||||||
|
if (defined($self->{sanity_options})) {
|
||||||
|
$self->{options}->set_sanity();
|
||||||
|
}
|
||||||
|
|
||||||
# Output HELP
|
# Output HELP
|
||||||
$self->{options}->add_help(package => 'centreon::plugins::output', sections => 'OUTPUT OPTIONS');
|
$self->{options}->add_help(package => 'centreon::plugins::output', sections => 'OUTPUT OPTIONS');
|
||||||
|
@ -256,21 +260,25 @@ __END__
|
||||||
|
|
||||||
Choose a mode.
|
Choose a mode.
|
||||||
|
|
||||||
|
=item B<--dyn-mode>
|
||||||
|
|
||||||
|
Specify a mode with the path (separated by '::').
|
||||||
|
|
||||||
=item B<--list-mode>
|
=item B<--list-mode>
|
||||||
|
|
||||||
List available modes.
|
List available modes.
|
||||||
|
|
||||||
=item B<--version>
|
|
||||||
|
|
||||||
Display plugin version.
|
|
||||||
|
|
||||||
=item B<--mode-version>
|
=item B<--mode-version>
|
||||||
|
|
||||||
Check minimal version of mode. If not, unknown error.
|
Check minimal version of mode. If not, unknown error.
|
||||||
|
|
||||||
=item B<--dyn-mode>
|
=item B<--version>
|
||||||
|
|
||||||
Specify a mode with the path (separated by '::').
|
Display plugin version.
|
||||||
|
|
||||||
|
=item B<--sanity-options>
|
||||||
|
|
||||||
|
Check unknown options (for debug purpose).
|
||||||
|
|
||||||
=item B<--sqlmode>
|
=item B<--sqlmode>
|
||||||
|
|
||||||
|
|
|
@ -52,10 +52,11 @@ sub new {
|
||||||
|
|
||||||
$self->{options}->add_options(
|
$self->{options}->add_options(
|
||||||
arguments => {
|
arguments => {
|
||||||
'mode:s' => { name => 'mode' },
|
'mode:s' => { name => 'mode_name' },
|
||||||
'dyn-mode:s' => { name => 'dynmode_name' },
|
'dyn-mode:s' => { name => 'dynmode_name' },
|
||||||
'list-mode' => { name => 'list_mode' },
|
'list-mode' => { name => 'list_mode' },
|
||||||
'mode-version:s' => { name => 'mode_version' },
|
'mode-version:s' => { name => 'mode_version' },
|
||||||
|
'sanity-options' => { name => 'sanity_options' },
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
$self->{version} = '1.0';
|
$self->{version} = '1.0';
|
||||||
|
@ -63,9 +64,10 @@ sub new {
|
||||||
$self->{default} = undef;
|
$self->{default} = undef;
|
||||||
|
|
||||||
$self->{options}->parse_options();
|
$self->{options}->parse_options();
|
||||||
$self->{mode_name} = $self->{options}->get_option(argument => 'mode');
|
$self->{option_results} = $self->{options}->get_options();
|
||||||
$self->{list_mode} = $self->{options}->get_option(argument => 'list_mode');
|
foreach (keys %{$self->{option_results}}) {
|
||||||
$self->{mode_version} = $self->{options}->get_option(argument => 'mode_version');
|
$self->{$_} = $self->{option_results}->{$_};
|
||||||
|
}
|
||||||
$self->{options}->clean();
|
$self->{options}->clean();
|
||||||
|
|
||||||
$self->{options}->add_help(package => $options{package}, sections => 'PLUGIN DESCRIPTION');
|
$self->{options}->add_help(package => $options{package}, sections => 'PLUGIN DESCRIPTION');
|
||||||
|
@ -89,6 +91,9 @@ sub init {
|
||||||
if (defined($self->{list_mode})) {
|
if (defined($self->{list_mode})) {
|
||||||
$self->list_mode();
|
$self->list_mode();
|
||||||
}
|
}
|
||||||
|
if (defined($self->{sanity_options})) {
|
||||||
|
$self->{options}->set_sanity();
|
||||||
|
}
|
||||||
|
|
||||||
# Output HELP
|
# Output HELP
|
||||||
$self->{options}->add_help(package => 'centreon::plugins::output', sections => 'OUTPUT OPTIONS');
|
$self->{options}->add_help(package => 'centreon::plugins::output', sections => 'OUTPUT OPTIONS');
|
||||||
|
@ -206,13 +211,17 @@ Specify a mode with the path (separated by '::').
|
||||||
|
|
||||||
List available modes.
|
List available modes.
|
||||||
|
|
||||||
|
=item B<--mode-version>
|
||||||
|
|
||||||
|
Check minimal version of mode. If not, unknown error.
|
||||||
|
|
||||||
=item B<--version>
|
=item B<--version>
|
||||||
|
|
||||||
Display plugin version.
|
Display plugin version.
|
||||||
|
|
||||||
=item B<--mode-version>
|
=item B<--sanity-options>
|
||||||
|
|
||||||
Check minimal version of mode. If not, unknown error.
|
Check unknown options (for debug purpose).
|
||||||
|
|
||||||
=back
|
=back
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue