mirror of
https://github.com/centreon/centreon-plugins.git
synced 2025-07-25 14:44:43 +02:00
enhance indent
This commit is contained in:
parent
faa634b6e8
commit
46e977c081
@ -28,7 +28,7 @@ use Digest::SHA 'sha1_hex';
|
||||
|
||||
my %map_ovh_type = (
|
||||
OVH_API_EU => 'https://eu.api.ovh.com/1.0',
|
||||
OVH_API_CA => 'https://ca.api.ovh.com/1.0',
|
||||
OVH_API_CA => 'https://ca.api.ovh.com/1.0'
|
||||
);
|
||||
|
||||
sub new {
|
||||
@ -47,11 +47,11 @@ sub new {
|
||||
|
||||
if (!defined($options{noptions})) {
|
||||
$options{options}->add_options(arguments => {
|
||||
"ovh-type:s@" => { name => 'ovh_type' },
|
||||
"ovh-application-key:s@" => { name => 'ovh_application_key' },
|
||||
"ovh-application-secret:s@" => { name => 'ovh_application_secret' },
|
||||
"ovh-consumer-key:s@" => { name => 'ovh_consumer_key' },
|
||||
"timeout:s@" => { name => 'timeout' },
|
||||
'ovh-type:s@' => { name => 'ovh_type' },
|
||||
'ovh-application-key:s@' => { name => 'ovh_application_key' },
|
||||
'ovh-application-secret:s@' => { name => 'ovh_application_secret' },
|
||||
'ovh-consumer-key:s@' => { name => 'ovh_consumer_key' },
|
||||
'timeout:s@' => { name => 'timeout' }
|
||||
});
|
||||
}
|
||||
$options{options}->add_help(package => __PACKAGE__, sections => 'REST API OPTIONS', once => 1);
|
||||
@ -61,23 +61,17 @@ sub new {
|
||||
$self->{http} = centreon::plugins::http->new(%options);
|
||||
|
||||
return $self;
|
||||
|
||||
}
|
||||
|
||||
# Method to manage multiples
|
||||
sub set_options {
|
||||
my ($self, %options) = @_;
|
||||
# options{options_result}
|
||||
|
||||
$self->{option_results} = $options{option_results};
|
||||
}
|
||||
|
||||
# Method to manage multiples
|
||||
sub set_defaults {
|
||||
my ($self, %options) = @_;
|
||||
# options{default}
|
||||
|
||||
# Manage default value
|
||||
foreach (keys %{$options{default}}) {
|
||||
if ($_ eq $self->{mode}) {
|
||||
for (my $i = 0; $i < scalar(@{$options{default}->{$_}}); $i++) {
|
||||
@ -181,8 +175,12 @@ sub get {
|
||||
|
||||
$self->settings(%options);
|
||||
|
||||
my $response = $self->{http}->request(full_url => $map_ovh_type{uc($self->{ovh_type})} . $options{path},
|
||||
hostname => '', critical_status => '', warning_status => '');
|
||||
my $response = $self->{http}->request(
|
||||
full_url => $map_ovh_type{uc($self->{ovh_type})} . $options{path},
|
||||
hostname => '',
|
||||
critical_status => '',
|
||||
warning_status => ''
|
||||
);
|
||||
my ($client_warning) = $self->{http}->get_header(name => 'Client-Warning');
|
||||
if (defined($client_warning) && $client_warning eq 'Internal response') {
|
||||
$self->{output}->add_option_msg(short_msg => "Internal LWP::UserAgent error: $response");
|
||||
|
Loading…
x
Reference in New Issue
Block a user