remove trailing newline from os_ver, fixes netdisco #647 (#364)

* remove trailing newline from os_ver, fixes netdisco #647

* note why the newline is in the test

* also update tests

* typo
This commit is contained in:
nick n
2019-09-26 00:58:16 +02:00
committed by GitHub
parent 631f99f97b
commit f941f432e9
2 changed files with 26 additions and 5 deletions

View File

@@ -48,7 +48,7 @@ $VERSION = '3.68';
%GLOBALS = ( %GLOBALS = (
%SNMP::Info::Layer7::GLOBALS, %SNMP::Info::Layer7::GLOBALS,
'os_ver' => 'productVersion', 'pulse_os_ver' => 'productVersion',
'cpu' => 'iveCpuUtil', 'cpu' => 'iveCpuUtil',
); );
@@ -60,6 +60,17 @@ sub vendor {
return 'pulsesecure'; return 'pulsesecure';
} }
sub os_ver {
my $neoteris = shift;
my $p_os_ver = $neoteris->pulse_os_ver();
if (defined $p_os_ver) {
chomp ($p_os_ver);
return $p_os_ver;
}
return '';
}
sub os { sub os {
return 'ive'; return 'ive';
} }
@@ -150,7 +161,7 @@ Returns C<'ive'>.
=item $neoteris->os_ver() =item $neoteris->os_ver()
C<productVersion> C<productVersion> without trailing newline.
=item $neoteris->cpu() =item $neoteris->cpu()

View File

@@ -43,7 +43,10 @@ sub setup : Tests(setup) {
'_description' => 'Pulse Secure, LLC,Pulse Connect Secure,PSA-3000,8.2R7.2 (build 55673)', '_description' => 'Pulse Secure, LLC,Pulse Connect Secure,PSA-3000,8.2R7.2 (build 55673)',
# PULSESECURE-PSG-MIB::ivePSA3000 # PULSESECURE-PSG-MIB::ivePSA3000
# _pulse_os_ver newline is intentional, this is what the appliance returns
# see netdisco github issue #647
'_id' => '.1.3.6.1.4.1.12532.256.2.1', '_id' => '.1.3.6.1.4.1.12532.256.2.1',
'_pulse_os_ver' => "8.3R7.1 (build 65025)\n",
'store' => {}, 'store' => {},
}; };
$test->{info}->cache($cache_data); $test->{info}->cache($cache_data);
@@ -56,6 +59,13 @@ sub vendor : Tests(2) {
is($test->{info}->vendor(), 'pulsesecure', q(Vendor returns 'pulsesecure')); is($test->{info}->vendor(), 'pulsesecure', q(Vendor returns 'pulsesecure'));
} }
sub os_ver : Tests(2) {
my $test = shift;
can_ok($test->{info}, 'os_ver');
is($test->{info}->os_ver(), '8.3R7.1 (build 65025)', q(os_ver returns '8.3R7.1 (build 65025)'));
}
sub os : Tests(2) { sub os : Tests(2) {
my $test = shift; my $test = shift;