Merge pull request #195 from Icinga/fix/installer_crash_on_agent_msi_installer_package_detection

Fix: Agent installer crash on package lookup with different files in directory
This commit is contained in:
Lord Hepipud 2021-01-26 16:29:01 +01:00 committed by GitHub
commit 856e7624cc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 3 deletions

View file

@ -20,6 +20,7 @@ Released closed milestones can be found on [GitHub](https://github.com/Icinga/ic
* [#186](https://github.com/Icinga/icinga-powershell-framework/issues/186) Fixes path handling for custom local/web path sources for service binary installation
* [#188](https://github.com/Icinga/icinga-powershell-framework/pull/188) Removes hardcoded zones `director-global` and `global-zones` which were always set regardless of user specification. This fix will ensure the user has the option to add or not add these zones
* [#189](https://github.com/Icinga/icinga-powershell-framework/pull/189) Fixes wrong documented user group for accessing Performance Counter objects which should be `Performance Monitor Users`
* [#195](https://github.com/Icinga/icinga-powershell-framework/pull/195) Fix Agent installer crash on package lookup with different files in directory
## 1.3.0 (2020-12-01)

View file

@ -26,7 +26,16 @@ function Get-IcingaAgentMSIPackage()
$Content = Get-ChildItem -Path $Source;
foreach ($entry in $Content) {
# Only check for MSI packages
if ($entry.Extension.ToLower() -ne '.msi') {
continue;
}
$PackageVersion = '';
if ($entry.Name.ToLower().Contains('-')) {
$PackageVersion = ($entry.Name.Split('-')[1]).Replace('v', '');
}
if ($Version -eq 'snapshot') {
if ($PackageVersion -eq 'snapshot') {
@ -40,9 +49,13 @@ function Get-IcingaAgentMSIPackage()
continue;
}
try {
if ($null -eq $UseVersion -Or [version]$PackageVersion -ge [version]$UseVersion) {
$UseVersion = $PackageVersion;
}
} catch {
# Nothing to catch specifically
}
}
} else {
$Content = (Invoke-IcingaWebRequest -Uri $Source -UseBasicParsing).RawContent.Split("`r`n");