mirror of
https://github.com/centreon/centreon-plugins.git
synced 2025-07-27 07:34:35 +02:00
fix(ericsson/enm): session expiration (#3324)
This commit is contained in:
parent
d890050436
commit
177c6c24af
@ -45,13 +45,13 @@ sub new {
|
|||||||
|
|
||||||
if (!defined($options{noptions})) {
|
if (!defined($options{noptions})) {
|
||||||
$options{options}->add_options(arguments => {
|
$options{options}->add_options(arguments => {
|
||||||
'hostname:s' => { name => 'hostname' },
|
'hostname:s' => { name => 'hostname' },
|
||||||
'port:s' => { name => 'port' },
|
'port:s' => { name => 'port' },
|
||||||
'proto:s' => { name => 'proto' },
|
'proto:s' => { name => 'proto' },
|
||||||
'api-username:s' => { name => 'api_username' },
|
'api-username:s' => { name => 'api_username' },
|
||||||
'api-password:s' => { name => 'api_password' },
|
'api-password:s' => { name => 'api_password' },
|
||||||
'timeout:s' => { name => 'timeout' },
|
'timeout:s' => { name => 'timeout' },
|
||||||
'cache-use' => { name => 'cache_use' }
|
'cache-use' => { name => 'cache_use' }
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
$options{options}->add_help(package => __PACKAGE__, sections => 'REST API OPTIONS', once => 1);
|
$options{options}->add_help(package => __PACKAGE__, sections => 'REST API OPTIONS', once => 1);
|
||||||
@ -132,7 +132,7 @@ sub login {
|
|||||||
my $session_id = $self->{cache_token}->get(name => 'session_id');
|
my $session_id = $self->{cache_token}->get(name => 'session_id');
|
||||||
my $md5_secret_cache = $self->{cache_token}->get(name => 'md5_secret');
|
my $md5_secret_cache = $self->{cache_token}->get(name => 'md5_secret');
|
||||||
my $md5_secret = md5_hex($self->{api_username} . $self->{api_password});
|
my $md5_secret = md5_hex($self->{api_username} . $self->{api_password});
|
||||||
|
|
||||||
if ($has_cache_file == 0 ||
|
if ($has_cache_file == 0 ||
|
||||||
!defined($session_id) ||
|
!defined($session_id) ||
|
||||||
(defined($md5_secret_cache) && $md5_secret_cache ne $md5_secret)
|
(defined($md5_secret_cache) && $md5_secret_cache ne $md5_secret)
|
||||||
@ -180,6 +180,7 @@ sub clean_session {
|
|||||||
|
|
||||||
my $datas = { updated => time() };
|
my $datas = { updated => time() };
|
||||||
$self->{cache_token}->write(data => $datas);
|
$self->{cache_token}->write(data => $datas);
|
||||||
|
$self->{session_id} = undef;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub credentials {
|
sub credentials {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user