Skip to content

Commit

Permalink
fix: update detection of service pack on SLES15
Browse files Browse the repository at this point in the history
  • Loading branch information
g-bougard committed Mar 30, 2022
1 parent 9418c6e commit 5043b15
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
1 change: 1 addition & 0 deletions Changes
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ inventory:
* database inventory: support default credential to inventory SQL Server 2012 Express
* linux: Update drive inventory to also try FS related tools to get more information
* feat: Add OS installation date inventory support for unix/linux
* Fix linux SLES 15 Service Pack detection, thanks to ncharles@gh

remoteinventory:
* Fix: Support username for SSH access
Expand Down
17 changes: 13 additions & 4 deletions lib/GLPI/Agent/Task/Inventory/Linux/Distro/NonLSB.pm
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,19 @@ sub _getDistroData {
};

if ($name eq 'SuSE') {
$data->{SERVICE_PACK} = getFirstMatch(
file => '/etc/SuSE-release',
pattern => qr/^PATCHLEVEL = ([0-9]+)/
);
# SLES15 doesn't have /etc/SuSE-release
if (-e '/etc/SuSE-release') {
$data->{SERVICE_PACK} = getFirstMatch(
file => '/etc/SuSE-release',
pattern => qr/^PATCHLEVEL = ([0-9]+)/
);
} else {
# fall back by checking if there's a -SP in the current version
# if so, split by -SP
if ($version =~ m/\-SP.+/) {
($data->{VERSION}, $data->{SERVICE_PACK}) = $version =~ m/(.*)-SP(.*)/;
}
}
}

return $data;
Expand Down

0 comments on commit 5043b15

Please sign in to comment.