fix(hpe/simplivity): authentication (#3407)

This commit is contained in:
qgarnier 2022-01-17 16:46:55 +01:00 committed by GitHub
parent 8e7953d3a4
commit eef428f207
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View File

@ -132,7 +132,6 @@ sub json_decode {
sub build_options_for_httplib {
my ($self, %options) = @_;
$self->{option_results}->{hostname} = $self->{hostname};
$self->{option_results}->{port} = $self->{port};
$self->{option_results}->{proto} = $self->{proto};
}
@ -167,6 +166,7 @@ sub get_auth_token {
(defined($md5_secret_cache) && $md5_secret_cache ne $md5_secret)) {
my ($content) = $self->{http}->request(
method => 'POST',
hostname => 'simplivity@' . $self->{hostname},
url_path => '/api/oauth/token',
post_param => [
'grant_type=password',
@ -212,6 +212,7 @@ sub request_api {
my $content = $self->{http}->request(
method => 'GET',
hostname => $self->{hostname},
url_path => $options{endpoint},
get_param => $options{get_param},
warning_status => '',
@ -224,6 +225,8 @@ sub request_api {
$self->clean_token(statefile => $self->{cache});
$self->get_auth_token(statefile => $self->{cache});
$content = $self->{http}->request(
method => 'GET',
hostname => $self->{hostname},
url_path => $options{endpoint},
get_param => $options{get_param},
warning_status => '', unknown_status => '', critical_status => ''

View File

@ -166,7 +166,7 @@ Check virtual machines.
=over 8
=item B<--filter-name>
=item B<--filter-vm-name>
Filter virtual machines by virtual machine name.